get('accounts', 'uid', ['username' => strtolower($VARS['username'])]); $change_password = true; break; case "NORMAL": $username_ok = true; break; case "ALERT_ON_ACCESS": $mail_resp = sendLoginAlertEmail($VARS['username']); if (DEBUG) { var_dump($mail_resp); } $username_ok = true; break; default: if (!is_empty($error)) { $alert = $error; } else { $alert = lang("login error", false); } break; } if ($username_ok) { if (authenticate_user($VARS['username'], $VARS['password'], $autherror)) { $_SESSION['passok'] = true; // stop logins using only username and authcode if (userHasTOTP($VARS['username'])) { $multiauth = true; $_SESSION['password'] = $VARS['password']; } else { doLoginUser($VARS['username'], $VARS['password']); insertAuthLog(1, $_SESSION['uid']); header('Location: home.php'); die("Logged in, go to home.php"); } } else { if (!is_empty($autherror)) { $alert = $autherror; insertAuthLog(2, null, "Username: " . $VARS['username']); } else { $alert = lang("login incorrect", false); insertAuthLog(2, null, "Username: " . $VARS['username']); } } } } else { // User does not exist anywhere $alert = lang("login incorrect", false); insertAuthLog(2, null, "Username: " . $VARS['username']); } } else { $alert = lang("captcha error", false); insertAuthLog(8, null, "Username: " . $VARS['username']); } } else if ($VARS['progress'] == "2") { engageRateLimit(); if ($_SESSION['passok'] !== true) { // stop logins using only username and authcode sendError("Password integrity check failed!"); } if (verifyTOTP($VARS['username'], $VARS['authcode'])) { doLoginUser($VARS['username'], $VARS['password']); insertAuthLog(1, $_SESSION['uid']); header('Location: home.php'); die("Logged in, go to home.php"); } else { $alert = lang("2fa incorrect", false); insertAuthLog(6, null, "Username: " . $VARS['username']); } } else if ($VARS['progress'] == "chpasswd") { engageRateLimit(); if (!is_empty($_SESSION['username'])) { $error = []; $result = change_password($VARS['oldpass'], $VARS['newpass'], $VARS['conpass'], $error); if ($result === TRUE) { $alert = lang(MESSAGES["password_updated"]["string"], false); $alerttype = MESSAGES["password_updated"]["type"]; } switch (count($error)) { case 0: break; case 1: $alert = lang(MESSAGES[$error[0]]["string"], false); $alerttype = MESSAGES[$error[0]]["type"]; break; case 2: $alert = lang2(MESSAGES[$error[0]]["string"], ["arg" => $error[1]], false); $alerttype = MESSAGES[$error[0]]["type"]; break; default: $alert = lang(MESSAGES["generic_op_error"]["string"], false); $alerttype = MESSAGES["generic_op_error"]["type"]; } } else { session_destroy(); header('Location: index.php'); die(); } } ?> <?php echo SITE_TITLE; ?>

" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus />
" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />

" required="required" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" autofocus />