Exemplo n.º 1
0
 /**
  * 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
  * @return bool|void
  */
 public function validatePassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = AuthUser::findByUsername($this->username);
         if (!$user || !$user->validatePassword($this->password)) {
             $this->addError($attribute, 'Incorrect username or password.');
         }
     }
 }