mirror of
https://github.com/ZeJMaN/LBCAlerte_ynh.git
synced 2025-07-17 17:10:48 +02:00
Initial commit
Functional, without SSO
This commit is contained in:
25
sources/app/default/scripts/login.php
Normal file
25
sources/app/default/scripts/login.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$username = "";
|
||||
$errors = array();
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (!isset($_POST["username"]) || !trim($_POST["username"])) {
|
||||
$errors["password"] = "Nom d'utilisateur ou mot de passe incorrecte.";
|
||||
} else {
|
||||
$username = $_POST["username"];
|
||||
}
|
||||
if (empty($errors)) {
|
||||
$password = isset($_POST["password"])?$_POST["password"]:"";
|
||||
$auth->setUsername($username)
|
||||
->setPassword(sha1($password));
|
||||
if ($auth->authenticate()) {
|
||||
if ($module == "default" && $action == "login") {
|
||||
$redirect = "./";
|
||||
} else {
|
||||
$redirect = $_SERVER["REQUEST_URI"];
|
||||
}
|
||||
header("LOCATION: ".$redirect);
|
||||
exit;
|
||||
}
|
||||
$errors["password"] = "Nom d'utilisateur ou mot de passe incorrecte.";
|
||||
}
|
||||
}
|
5
sources/app/default/scripts/logout.php
Normal file
5
sources/app/default/scripts/logout.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$auth->clear();
|
||||
header("LOCATION: ./");
|
||||
exit;
|
Reference in New Issue
Block a user