Added database queries during login flow

This commit is contained in:
djpbessems
2019-01-24 19:48:29 +01:00
parent 118e45db9c
commit ef4c97a784
3 changed files with 26 additions and 8 deletions

View File

@ -7,7 +7,7 @@
$result = authenticateLDAP($_POST['username'], $_POST['password']);
if ($result['status'] == 'Success') {
// Save secure token in cookie
setcookie('JWT', $result['token'], (time() + $settings->Session['Duration']));
setcookie('JWT', $result['token'], (time() + $settings->Session['Duration']));
// Convert base64 encoded string back from JSON;
// forcing it into an associative array (instead of javascript's default StdClass object)

View File

@ -35,7 +35,10 @@
header("HTTP/1.1 202 Accepted");
exit;
} else {
// No cookie containing valid authentication token found, redirecting to loginpage
// No cookie containing valid authentication token found;
// explicitly deleting any remaining cookie, then redirecting to loginpage
setcookie('JWT', FALSE);
header("HTTP/1.1 401 Unauthorized");
header("Location: lucidAuth.login.php?ref=" . base64_encode(json_encode($proxyHeaders)));
}