A wrapper for the validOneTimePassword method from OneTimePasswordBehavior.
@param $attribute string
@param $params array
@return boolean
339297
public function validOneTimePassword($attribute, $params)
    {
        if (($behavior = $this->getBehavior('oneTimePasswordBehavior')) !== null) {
            return $behavior->validOneTimePassword($attribute, $params);
        }

        return true;
    }
1277596
protected function validateBefore( $attribute, $value, $parameters )
	{
		$this->requireParameterCount( 1, $parameters, 'before' );

		if ( !is_string( $value ) && !is_numeric( $value ) && !$value instanceof DateTimeInterface )
		{
			return false;
		}

		if ( $format = $this->getDateFormat( $attribute ) )
		{
			return $this->validateBeforeWithFormat( $format, $value, $parameters );
		}

		if ( !$date = $this->getDateTimestamp( $parameters[0] ) )
		{
			$date = $this->getDateTimestamp( $this->getValue( $parameters[0] ) );
		}

		return $this->getDateTimestamp( $value ) < $date;
	}
435257
public function validateMobileUpdate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$existingUser = self::findByMobile( $this->mobile );

			if( isset( $existingUser ) && $this->id != $existingUser->id ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_MOBILE_EXIST ) );
			}
		}
	}
780802
public function validateUsernameChange( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$properties		= CoreProperties::getInstance();
			$existingUser	= self::findById( $this->id );

			if( isset( $existingUser ) && $existingUser->username !== $this->username  && !$properties->isChangeUsername() ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_CHANGE_USERNAME ) );
			}
		}
	}
963935
public function validateMobileCreate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( self::isExistByMobile( $this->mobile ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_MOBILE_EXIST ) );
			}
		}
	}
532612
public function validateMimes($attribute, $value, $parameters)
    {
        if (! $this->isValidFileInstance($value)) {
            return false;
        }

        if ($this->shouldBlockPhpUpload($value, $parameters)) {
            return false;
        }

        return $value->getPath() !== '' && in_array($value->guessExtension(), $parameters);
    }
1125180
public function validateUsername( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( $this->userService->isExistByUsername( $this->username ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_USERNAME_EXIST ) );
			}
		}
	}
303810
protected function validateDigitsBetween($attribute, $value, $parameters)
	{
		$length = strlen((string) $value);

		return $length >= $parameters[0] && $length <= $parameters[1];
	}
739438
protected function validateDateFormat( $attribute, $value, $parameters )
	{
		$this->requireParameterCount( 1, $parameters, 'date_format' );

		if ( !is_string( $value ) && !is_numeric( $value ) )
		{
			return false;
		}

		$parsed = date_parse_from_format( $parameters[0], $value );

		return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0;
	}
1128807
public function validateEmailCreate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( self::isExistByEmail( $this->email ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_EMAIL_EXIST ) );
			}
		}
	}
523627
protected function validateUsername($attribute, $value, $parameters)
    {
        // Use provided regex or use fallback
        $pattern = ! empty($parameters[0]) ? $parameters[0] : '/^([a-zA-Z0-9._-])+$/i';

        return (bool) preg_match($pattern, $value);
    }
379421
public function validatePassword($attribute)
    {
        if (!$this->hasErrors()) {
            $user = $this->getUser();
            
            if ($user && $this->userAttemptBruteForceLock($user)) {
                return $this->addError($attribute, Module::t('model_loginform_max_user_attempts', ['time' => Yii::$app->formatter->asRelativeTime($user->login_attempt_lock_expiration)]));
            }
            
            if (!$user || !$user->validatePassword($this->password)) {
                if ($this->attempts) {
                    // use `model_loginform_wrong_user_or_password` instead of `model_loginform_wrong_user_or_password_attempts` due to informations about correct email input.
                    $this->addError($attribute, Module::t('model_loginform_wrong_user_or_password', ['attempt' => $this->attempts, 'allowedAttempts' => $this->allowedAttempts]));
                } else {
                    $this->addError($attribute, Module::t('model_loginform_wrong_user_or_password'));
                }
            }
        }
    }
66088
public function authenticate($attribute, $params)
    {
        if ($this->hasErrors()) {
            return false;
        }
        $identity = $this->getIdentity();
        if (!$identity) {
            $this->addError($attribute, Yii::t('usr', 'Invalid username or password.'));

            return false;
        }
        $password = $this->scenario === 'reset' ? $this->newPassword : $this->password;
        if (($error = $identity->authenticate($password)) !== true) {
            list($code, $message) = $error;
            $this->addError($attribute, $message);

            return false;
        }

        return true;
    }
582578
protected function validateAfter($attribute, $value, $parameters)
	{
		if ( ! ($date = strtotime($parameters[0])))
		{
			return strtotime($value) > strtotime($this->getValue($parameters[0]));
		}
		else
		{
			return strtotime($value) > $date;
		}
	}
553807
public function validateEmailChange( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$properties		= CoreProperties::getInstance();
			$existingUser	= self::findById( $this->id );

			if( isset( $existingUser ) && $existingUser->email !== $this->email && !$properties->isChangeEmail() ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_CHANGE_EMAIL ) );
			}
		}
	}
892091
protected function validateRegex($attribute, $value, $parameters)
    {
        if (! is_string($value) && ! is_numeric($value)) {
            return false;
        }

        $this->requireParameterCount(1, $parameters, 'regex');

        return preg_match($parameters[0], $value);
    }
1215090
public function validateId($attribute, $params)
    {
        foreach (Yii::$app->user->getLoginPriority() as $item) {
            if ($item::validate($this->$attribute)) {
                return;
            }
        }
        $this->addError($attribute, Yii::t('user', 'Incorrect ID.'));
    }