Commit 09fc0c3c by Qiang Xue

Merge pull request #4539 from mickgeek/master

Fix signature validation
parents 11f8a2d1 017572d8
...@@ -33,13 +33,16 @@ class LoginForm extends Model ...@@ -33,13 +33,16 @@ class LoginForm extends Model
/** /**
* Validates the password. * Validates the password.
* This method serves as the inline validation for 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()) { if (!$this->hasErrors()) {
$user = $this->getUser(); $user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) { if (!$user || !$user->validatePassword($this->password)) {
$this->addError('password', 'Incorrect username or password.'); $this->addError($attribute, 'Incorrect username or password.');
} }
} }
} }
......
...@@ -34,14 +34,17 @@ class LoginForm extends Model ...@@ -34,14 +34,17 @@ class LoginForm extends Model
/** /**
* Validates the password. * Validates the password.
* This method serves as the inline validation for 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()) { if (!$this->hasErrors()) {
$user = $this->getUser(); $user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) { if (!$user || !$user->validatePassword($this->password)) {
$this->addError('password', 'Incorrect username or password.'); $this->addError($attribute, 'Incorrect username or password.');
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment