$loggers['audit']->notice("Failed login attempt (username: {$_POST['email']})"); header('location:index.php?status=fail'); exit; } } elseif ($_GET['page'] === "forgot-password") { //The user has chosen to reset their password- show them the form $l10n->addResource(__DIR__ . '/l10n/forgot-password.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/forgot-password.php'; require_once FS_PHP . '/footer-external.php'; } else { if ($_GET['page'] === "reset-user-password") { //Handle the logic for checking if the user is eligible to reset their password if ($faculty_profile->checkIfUserExists($_POST['email'])) { if ($_POST['password'] === $_POST['password_confirm']) { $faculty_profile->resetUserPassword($_POST); $loggers['audit']->info("Password reset initiated for user {$_POST['email']}"); $activation_status = "waiting"; $l10n->addResource(__DIR__ . '/l10n/forgot-password-result.json'); require_once FS_PHP . '/header-external.php'; require_once 'views/forgot-password-result.php'; require_once FS_PHP . '/footer-external.php'; } else { $loggers['audit']->notice("Failed password reset attempt - password mismatch"); if (filter_var($_POST['email'] . EMAIL_ORG_STAFF_DOMAIN, FILTER_VALIDATE_EMAIL)) { header('Location: index.php?page=forgot-password&mode=password_mismatch&email=' . $_POST['email']); exit; } header('Location: index.php'); exit; }