/** * Validates the password. * This method serves as the inline validation for password. * * @param string $attribute the attribute currently being validated * @param array $params the additional name-value pairs given in the rule */ public function validateEmail($attribute, $params) { if (!$this->hasErrors()) { $user_email = User::findByUsernameFromJsonValidate($this->email, 'email'); if ($user_email) { $this->addError($attribute, 'This email address has already been taken.'); } } }