public function checkLastPasswords(string $value, array $context): bool
    {
        // return true if config is not set
        if (empty($this->getConfig('oldPasswordCount'))) {
            return true;
        }

        // ignore on new user
        if (empty($context['data']['id'])) {
            return true;
        }
        $user = $this->_table->get($context['data']['id']);

        if (is_array($user->last_passwords)) {
            foreach ($user->last_passwords as $oldPasswordHash) {
                if ((new DefaultPasswordHasher)->check($value, $oldPasswordHash)) {
                    return false;
                }
            }
        }

        return true;
    }
public function checkLastPasswords(string $value, array $context): bool
    {
        // return true if config is not set
        if (empty($this->getConfig('oldPasswordCount'))) {
            return true;
        }

        // ignore on new user
        if (empty($context['data']['id'])) {
            return true;
        }
        $user = $this->_table->get($context['data']['id']);

        if (is_array($user->last_passwords)) {
            foreach ($user->last_passwords as $oldPasswordHash) {
                if ((new DefaultPasswordHasher)->check($value, $oldPasswordHash)) {
                    return false;
                }
            }
        }

        return true;
    }
public function checkLastPasswords ( string $ value , array $ context ) : bool { // return true if config is not set if ( empty ( $ this -> getConfig ( 'oldPasswordCount' ) ) ) { return true ; } // ignore on new user if ( empty ( $ context [ 'data' ] [ 'id' ] ) ) { return true ; } $ user = $ this -> _table -> get ( $ context [ 'data' ] [ 'id' ] ) ; if ( is_array ( $ user -> last_passwords ) ) { foreach ( $ user -> last_passwords as $ oldPasswordHash ) { if ( ( new DefaultPasswordHasher ) -> check ( $ value , $ oldPasswordHash ) ) { return false ; } } } return true ; }
Check for reusage of old passwords

@param  string $value   password
@param  array $context context data
@return bool
Check for reusage of old passwords