Validates user email to ensure that it does not allow to change while changing user profile.

@param type $attribute
@param type $params
@return void
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 ) );
			}
		}
	}
144836
protected function validateDigits($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'digits');

        return $this->validateNumeric($attribute, $value)
            && strlen((string) $value) == $parameters[0];
    }
1125217
public function validatePassword($attribute)
    {
        if (!$this->hasErrors()) {
            if ($this->user === null || !PasswordHelper::validate($this->password, $this->user->password_hash)) {
                $this->addError($attribute, Yii::t('yuncms', 'Invalid login or password'));
            }
        }
    }
225908
public function validateReservedKeyword($attribute, $params)
    {
        if ($this->isReservedKeyword($this->$attribute)) {
            $this->addError($attribute, $this->getAttributeLabel($attribute) . ' cannot be a reserved PHP keyword.');
        }
    }
487734
public function validateEmailUpdate( $attribute, $params ) {

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

			$existingUser = self::findByEmail( $this->email );

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

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_EMAIL_EXIST ) );
			}
		}
	}
830801
public function termsValidator( $attribute, $params ) {

		if( $this->terms === 'on' ) {

			return;
		}

		if( !isset( $this->terms ) || $this->terms <= 0 ) {

			$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_TERMS ) );
		}
	}
51825
public function validateEmails($attribute)
    {
        $items = $this->$attribute;

        if (!is_array($items)) {
            $items = [];
        }

        foreach ($items as $index => $item) {
            $validator = new EmailValidator();
            $error = null;
            $validator->validate($item, $error);
            if (!empty($error)) {
                $key = $attribute . '[' . $index . ']';
                $this->addError($key, $error);
            }
        }
    }
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.'));
    }
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 ) );
			}
		}
	}
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;
    }
1365203
public function validateAttribute($model, $attribute)
    {
        $this->_model = $model;
        $this->_attributeName = $attribute;
        $result = $this->validateValue($model->$attribute);
        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);
        }
    }
417443
public function behaviorValidator($attribute, $params)
    {
        $behavior = $params['behavior'];
        $validator = $params['validator'];
        unset($params['behavior']);
        unset($params['validator']);
        if (($behavior = $this->getBehavior($behavior)) !== null) {
            return $behavior->{$validator}($attribute, $params);
        }

        return true;
    }
60434
public function validateAttribute($model, $attribute)
    {
        $value = $model->$attribute;
        $result = $this->validateValue($value);

        if (!empty($result)) {
            $this->addError($model, $attribute, $this->renderMessage($model, $attribute));
        }
    }
704136
public function validateDistinct($attribute, $value, $parameters)
    {
        $data = Arr::except($this->getDistinctValues($attribute), $attribute);

        if (in_array('ignore_case', $parameters)) {
            return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data));
        }

        return ! in_array($value, array_values($data));
    }
10001
public function validateDifferent($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'different');

        foreach ($parameters as $parameter) {
            if (! Arr::has($this->data, $parameter)) {
                return false;
            }

            $other = Arr::get($this->data, $parameter);

            if ($value === $other) {
                return false;
            }
        }

        return true;
    }
690952
public function validatePassword($attribute, $params)
    {
        if (!$this->hasErrors()) {
            $user = $this->getUser();
            if (!$user || !$user->validatePassword($this->password)) {
                $this->addError($attribute, Yii::t($this->tcModule, 'Incorrect username or password.'));
            }
        }
    }
842320
protected function validateBic($attribute, $value, $parameters)
    {
        // Use provided regex or use fallback
        $pattern = ! empty($parameters[0]) ? $parameters[0] : '/^[A-Za-z]{4,} ?[A-Za-z]{2,} ?[A-Za-z0-9]{2,} ?([A-Za-z0-9]{3,})?$/';

        return (bool) preg_match($pattern, $value);
    }