/** * Check if the user's password is the same as the provided one. * * @param User $user * @param string $password * @return bool */ public static function verifyPassword($user, $password) { return password_verify($password, $user->getPassword()); }
/** * {@inheritDoc} */ public function getPassword() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPassword', array()); return parent::getPassword(); }
/** * Static function for checking hashed password (as required by Doctrine) * * @param User $user The identity object * @param string $password Password provided by the user, to verify * * @return boolean If the password was correct or not */ public static function verifyHashedPassword(User $user, $password) { $bcrypt = new Bcrypt(); return $bcrypt->verify($password, $user->getPassword()); }