verifyPasswordReset() public static method

Verifies the password reset request via the verification hash token (that's only valid for one hour)
public static verifyPasswordReset ( string $user_name, string $verification_code ) : boolean
$user_name string Username
$verification_code string Hash token
return boolean Success status
示例#1
0
 /**
  * Verify the verification token of that user (to show the user the password editing view or not)
  * @param string $user_name username
  * @param string $verification_code password reset verification token
  */
 public function verifyPasswordReset($user_name, $verification_code)
 {
     // check if this the provided verification code fits the user's verification code
     if (PasswordResetModel::verifyPasswordReset($user_name, $verification_code)) {
         // pass URL-provided variable to view to display them
         $this->View->render('login/resetPassword', array('user_name' => $user_name, 'user_password_reset_hash' => $verification_code));
     } else {
         Redirect::to('login/index');
     }
 }
示例#2
0
<?php

require_once __DIR__ . '/../classes/Tools.php';
require_once __DIR__ . '/../classes/SessionWrapper.php';
Tools::startSession();
$email1 = Request::get('email');
$code1 = Request::get('code');
if (empty($email1) || empty($code1)) {
    // redirect to the home page
    header("HTTP/1.0 301 Moved Permanently");
    header("Location: " . Tools::getBaseUrl());
    exit;
}
SessionWrapper::clearFeedback();
$verified = PasswordResetModel::verifyPasswordReset($email1, $code1);
if ($verified) {
    SessionWrapper::clearFeedback();
    if (!empty($_POST)) {
        $reset = PasswordResetModel::setNewPassword($email1, $code1, $_POST['user_password_new'], $_POST['user_password_repeat']);
    }
}
$headerMeta = array('es' => array('title' => 'Reestablecer contraseña'), 'en' => array('title' => 'Reset password'));
$headerResources = '
  <link href="' . Tools::getBaseUrl() . '/css/style-registro.css" rel="stylesheet" />';
require_once '../header.php';
?>

      <main class="text-center">
        <?php 
if ($verified) {
    if (!$reset) {