Files
archived-web-bugs/include/auth.php
Peter Kokot 80d03e3e78 Move simple pages to templates
This is initial patch of the series of patches that moves the most
simple pages to templates.
2019-05-22 02:24:29 +02:00

32 lines
651 B
PHP

<?php
/**
* Temporary helper placeholder file to overcome the authentication service
* migration.
*
* TODO: Refactor this into a better authentication service.
*/
// Start session
session_start();
// Authenticate
bugs_authenticate($user, $pw, $logged_in, $user_flags);
if ('developer' === $logged_in) {
$isLoggedIn = true;
$username = $auth_user->handle;
} elseif (!empty($_SESSION['user'])) {
$isLoggedIn = true;
$username = $_SESSION['user'];
} else {
$isLoggedIn = false;
$username = '';
}
$template->assign([
'authIsLoggedIn' => $isLoggedIn,
'authUsername' => $username,
'authRole' => $logged_in,
]);