Pimcore\Model\User::getPassword PHP Method

getPassword() public method

public getPassword ( ) : string
return string
    public function getPassword()
    {
        return $this->password;
    }

Usage Example

Example #1
0
 /**
  * @param User $user
  * @param $password
  * @return bool
  */
 public static function verifyPassword($user, $password)
 {
     $password = self::preparePlainTextPassword($user->getName(), $password);
     if ($user->getPassword()) {
         // do not allow logins for users without a password
         if (password_verify($password, $user->getPassword())) {
             if (password_needs_rehash($user->getPassword(), PASSWORD_DEFAULT)) {
                 $user->setPassword(self::getPasswordHash($user->getName(), $password));
                 $user->save();
             }
             return true;
         }
     }
     return false;
 }