prepare("UPDATE account SET password = ?, password_enc = ? WHERE username = ?"); if ($stmt->execute([$password_hash, $password_enc, $username])) { unset($_SESSION['reset_username']); $success = "Password changed successfully. Redirecting to login page..."; } else { $error = "Failed to change password."; $step = 2; } } catch (PDOException $e) { $error = "Database Error."; $step = 2; } } } elseif (isset($_POST['action']) && $_POST['action'] === 'verify_pin') { $username = $_POST['username'] ?? ''; $pin = $_POST['pin'] ?? ''; if (empty($username) || empty($pin) || strlen($pin) < 6) { $error = "Username and 6-digit PIN are required."; } else { try { $stmt = $pdo->prepare("SELECT * FROM account WHERE username = ? AND pin = ?"); $stmt->execute([$username, $pin]); $user = $stmt->fetch(PDO::FETCH_ASSOC); if ($user) { $_SESSION['reset_username'] = $username; $_SESSION['reset_old_password'] = isset($user['password_enc']) ? $user['password_enc'] : '(not available)'; $step = 2; } else { $error = "Incorrect username or PIN."; } } catch (PDOException $e) { $error = "Database Error."; } } } } elseif (isset($_SESSION['reset_username'])) { // If they refresh on step 2 $step = 2; } ?> Forgot Password - Identia Admin
logo

Forgot Password

Verify your identity to reset password.

! Username Unavailable
Forgot ?
Remember your password? Sign in
logo

Change Password

Verification Success! Please create a new password for this account.

Account:

Current Password

Your old password is shown below. Please enter and confirm your new password to update it.

*Min. 8 characters, uppercase, lowercase, numbers & symbols.
Cancelled? Back to sign in
Warning
Message goes here