security/PasswordHistory.php
public static function isUsed($password, $user = null)
    {
        if (!User::isValid($user)) {
            throw new InvalidParamException('User Invalid.');
        }
        $passwords = static::find()->createdBy($user)->all();
        foreach ($passwords as $p) {
            /* @var $p static */
            if ($p->validatePassword($password)) {
                return $p;
            }
        }
        return false;
    }
public static function isUsed($password, $user = null)
    {
        if (!User::isValid($user)) {
            throw new InvalidParamException('User Invalid.');
        }
        $passwords = static::find()->createdBy($user)->all();
        foreach ($passwords as $p) {
            /* @var $p static */
            if ($p->validatePassword($password)) {
                return $p;
            }
        }
        return false;
    }
public static function isUsed ( $ password , $ user = null ) { if ( ! User :: isValid ( $ user ) ) { throw new InvalidParamException ( 'User Invalid.' ) ; } $ passwords = static :: find ( ) -> createdBy ( $ user ) -> all ( ) ; foreach ( $ passwords as $ p ) { /* @var $p static */ if ( $ p -> validatePassword ( $ password ) ) { return $ p ; } } return false ; }
Check whether the password has been used.
@param string $password Password or Password Hash.
@param User $user
@return false|static The first validated password model, or false if not validated.
Check whether the password has been used .