xref: /web-bugs/include/auth.php (revision 80d03e3e)
1<?php
2
3/**
4 * Temporary helper placeholder file to overcome the authentication service
5 * migration.
6 *
7 * TODO: Refactor this into a better authentication service.
8 */
9
10// Start session
11session_start();
12
13// Authenticate
14bugs_authenticate($user, $pw, $logged_in, $user_flags);
15
16if ('developer' === $logged_in) {
17    $isLoggedIn = true;
18    $username = $auth_user->handle;
19} elseif (!empty($_SESSION['user'])) {
20    $isLoggedIn = true;
21    $username = $_SESSION['user'];
22} else {
23    $isLoggedIn = false;
24    $username = '';
25}
26
27$template->assign([
28    'authIsLoggedIn' => $isLoggedIn,
29    'authUsername' => $username,
30    'authRole' => $logged_in,
31]);
32