if (!preg_match("/^[A-Za-z0-9]+\$/", $password)) { $validationArr[] = "Password can only contain the following characters: 'A-Z, a-z, 0-9'"; } if (strlen($password) < 5) { $validationArr[] = "Password must be at least 5 characters."; } if ($password != $confirmPassword) { $validationArr[] = "Passwords do not match."; } if (count($validationArr)) { $errorStr = implode("<br />", $validationArr); } else { $updateAccountPassword = $user->updatePassword($email, $token, $password, true); if ($updateAccountPassword['success']) { $data['content'] = "Your password has been reset. Click <a href='" . APP_URL . "' >here</a> to log in."; $template->render($data); return; } else { $errorStr = "There was an error updating this account's password."; } } } else { $errorStr = "You must enter a value for all fields."; } } if ($_GET && $_GET['email'] && $_GET['t']) { $email = $_GET['email']; $token = $_GET['t']; if ($user->accountUpdatable($email, $token, 1)) { $data['content'] = "\n <div style='width: 500px; text-align: center; margin: 50px auto;'>\n <span class='error'>{$errorStr}</span>\n <form method='post' action=''>\n <input type='hidden' name='email' value='{$email}' />\n <input type='hidden' name='t' value='{$token}' />\n <label>New Password:</label><br /><input type='password' id='password' name='password' /><br /><br />\n <label>Confirm New Password:</label><br /><input type='password' name='confirmPassword' /><br /><br />\n <input type='Submit' value='Reset Password' />\n </form>\n </div>\n <script type='text/javascript'>\n document.getElementById('password').focus();\n </script>\n "; } else {