예제 #1
0
 /**
  * Test unknown hash generation
  */
 public function testUnknownHash()
 {
     $this->setExpectedException(function_exists('password_hash') ? 'PHPUnit_Framework_Error' : 'InvalidArgumentException');
     Password::hash($this->examplePassword, -1);
 }
예제 #2
0
파일: Structure.php 프로젝트: gridguyz/core
 /**
  * Verify password
  *
  * @param   string      $password
  * @param   boolean     $rehashEnabled
  * @return  boolean|int
  */
 public function verifyPassword($password, $rehashEnabled = false)
 {
     if (empty($this->passwordHash)) {
         return false;
     }
     $verified = Password::verify($password, $this->passwordHash);
     if ($verified && $rehashEnabled && Password::needsRehash($this->passwordHash)) {
         $this->passwordHash = Password::hash($password);
         $this->save();
     }
     return $verified;
 }