exists()) { $status = $user->getStatus()->getString(); switch ($status) { case "LOCKED_OR_DISABLED": $alert = $Strings->get("account locked", false); break; case "TERMINATED": $alert = $Strings->get("account terminated", false); break; case "CHANGE_PASSWORD": $alert = $Strings->get("password expired", false); $alerttype = "info"; $_SESSION['username'] = $user->getUsername(); $_SESSION['uid'] = $user->getUID(); $change_password = true; break; case "NORMAL": $username_ok = true; break; case "ALERT_ON_ACCESS": $mail_resp = $user->sendAlertEmail(); if ($SETTINGS['debug']) { var_dump($mail_resp); } $username_ok = true; break; default: if (!empty($error)) { $alert = $error; } else { $alert = $Strings->get("login error", false); } break; } if ($username_ok) { if ($user->checkPassword($VARS['password'])) { $_SESSION['passok'] = true; // stop logins using only username and authcode if ($user->has2fa()) { $multiauth = true; } else { Session::start($user); Log::insert(LogType::LOGIN_OK, $user->getUID()); header('Location: app.php'); die("Logged in, go to app.php"); } } else { $alert = $Strings->get("login incorrect", false); Log::insert(LogType::LOGIN_FAILED, null, "Username: " . $VARS['username']); } } } else { // User does not exist anywhere $alert = $Strings->get("login incorrect", false); Log::insert(LogType::LOGIN_FAILED, null, "Username: " . $VARS['username']); } } else { $alert = $Strings->get("captcha error", false); Log::insert(LogType::BAD_CAPTCHA, null, "Username: " . $VARS['username']); } } else if ($VARS['progress'] == "2") { engageRateLimit(); $user = User::byUsername($VARS['username']); if ($_SESSION['passok'] !== true) { // stop logins using only username and authcode sendError("Password integrity check failed!"); } if ($user->check2fa($VARS['authcode'])) { Session::start($user); Log::insert(LogType::LOGIN_OK, $user->getUID()); header('Location: app.php'); die("Logged in, go to app.php"); } else { $alert = $Strings->get("2fa incorrect", false); Log::insert(LogType::BAD_2FA, null, "Username: " . $VARS['username']); } } else if ($VARS['progress'] == "chpasswd") { engageRateLimit(); if (!empty($_SESSION['username'])) { $user = User::byUsername($_SESSION['username']); try { $result = $user->changePassword($VARS['oldpass'], $VARS['newpass'], $VARS['conpass']); if ($result === TRUE) { $alert = $Strings->get(MESSAGES["password_updated"]["string"], false); $alerttype = MESSAGES["password_updated"]["type"]; } } catch (PasswordMatchException $e) { $alert = $Strings->get(MESSAGES["passwords_same"]["string"], false); $alerttype = "danger"; } catch (PasswordMismatchException $e) { $alert = $Strings->get(MESSAGES["new_password_mismatch"]["string"], false); $alerttype = "danger"; } catch (IncorrectPasswordException $e) { $alert = $Strings->get(MESSAGES["old_password_mismatch"]["string"], false); $alerttype = "danger"; } catch (WeakPasswordException $e) { $alert = $Strings->get(MESSAGES["weak_password"]["string"], false); $alerttype = "danger"; } } else { session_destroy(); header('Location: index.php'); die(); } } header("Link: ; rel=preload; as=style", false); header("Link: ; rel=preload; as=style", false); header("Link: ; rel=preload; as=style", false); header("Link: ; rel=preload; as=style", false); header("Link: ; rel=preload; as=script", false); header("Link: ; rel=preload; as=script", false); ?> <?php echo $SETTINGS['site_title']; ?>
get("sign in"); ?>
" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus />
" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />

get("2fa prompt"); ?>
" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus />