Fix signature validation

This commit is contained in:
mickgeek
2014-07-31 10:11:55 +04:00
parent 1c9fc33a40
commit 017572d8a5
2 changed files with 10 additions and 4 deletions

View File

@@ -33,13 +33,16 @@ class LoginForm extends Model
/**
* 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 validatePassword()
public function validatePassword($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError('password', 'Incorrect username or password.');
$this->addError($attribute, 'Incorrect username or password.');
}
}
}

View File

@@ -34,14 +34,17 @@ class LoginForm extends Model
/**
* 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 validatePassword()
public function validatePassword($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError('password', 'Incorrect username or password.');
$this->addError($attribute, 'Incorrect username or password.');
}
}
}