// Process the submitted form if ($_SERVER['REQUEST_METHOD'] === 'POST') { $user = User::findForPasswordReset($_POST['token']); if ($user !== null) { $user->password = $_POST['password']; $user->password_confirmation = $_POST['password_confirmation']; if ($user->resetPassword()) { // Redirect to success page Util::redirect('/reset_password_success.php'); } } } else { // GET // Find the user based on the token if (isset($_GET['token'])) { $user = User::findForPasswordReset($_GET['token']); } } // Set the title, show the page header, then the rest of the HTML $page_title = 'Reset password'; include 'includes/header.php'; ?> <h1>Reset password</h1> <?php if (isset($user)) { ?> <?php if (!empty($user->errors)) {