/**
  *
  */
 public function testValidate()
 {
     $password = '******';
     $hash = Password::hash($password, 4);
     $this->assertTrue(Password::validate('foobar', $hash));
     $this->assertFalse(Password::validate('føøbar', $hash));
 }
 /**
  * {@inheritdoc}
  */
 public function validatePassword(UserInterface $user, $password)
 {
     $hash = $user->getPassword();
     // Check if the provided password is valid
     $isValid = Password::validate($password, $hash);
     // Check if the password needs to be rehashed IF the provided password is valid
     if ($isValid && Password::needsRehash($hash)) {
         $user->setPassword($password);
         $user->save();
     }
     // Return validation result
     return $isValid;
 }
Beispiel #3
0
 /**
  * Validates a user password.
  *
  * @access  public
  * @param   string   $password  Password
  * @return  boolean
  */
 public function validatePassword($password)
 {
     return Password::validate($password, $this->password);
 }
 /**
  * Validates a user password.
  *
  * @access  public
  * @param   \mako\auth\user\UserInterface  $user      User object
  * @param   string                         $password  Password
  * @return  boolean
  */
 public function validatePassword(UserInterface $user, $password)
 {
     return Password::validate($password, $user->getPassword());
 }