From 017572d8a5227737d1a47df90101a326ad9a332e Mon Sep 17 00:00:00 2001 From: mickgeek Date: Thu, 31 Jul 2014 10:11:55 +0400 Subject: [PATCH] Fix signature validation --- apps/advanced/common/models/LoginForm.php | 7 +++++-- apps/basic/models/LoginForm.php | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/advanced/common/models/LoginForm.php b/apps/advanced/common/models/LoginForm.php index e4ebe79a6c..80a5f6af7f 100644 --- a/apps/advanced/common/models/LoginForm.php +++ b/apps/advanced/common/models/LoginForm.php @@ -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.'); } } } diff --git a/apps/basic/models/LoginForm.php b/apps/basic/models/LoginForm.php index 31b814e24e..687d29ded4 100644 --- a/apps/basic/models/LoginForm.php +++ b/apps/basic/models/LoginForm.php @@ -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.'); } } }