Jimmy Monin 57708e3169 Initial commit
Functional, without SSO
2016-09-18 11:03:26 +02:00

25 lines
846 B
PHP

<?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.";
}
}