Fixed CaptchaValidator to pass correct hashKey

Fixed `yii\validators\CaptchaValidator` passed incorrect hashKey to JS validator when `captchaAction` begins with `/`

Closes #10385
This commit is contained in:
SilverFire - Dmitry Naumenko
2015-12-15 12:45:00 +02:00
parent 8c86310003
commit 090a9875d9
2 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@ Yii Framework 2 Change Log
- Bug #10142: Fixed `yii\validators\EmailValidator` to check the length of email properly (silverfire) - Bug #10142: Fixed `yii\validators\EmailValidator` to check the length of email properly (silverfire)
- Bug #10278: Fixed `yii\helpers\BaseJson` support \SimpleXMLElement data (SilverFire, LAV45) - Bug #10278: Fixed `yii\helpers\BaseJson` support \SimpleXMLElement data (SilverFire, LAV45)
- Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire) - Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire)
- Bug #10385: Fixed `yii\validators\CaptchaValidator` passed incorrect hashKey to JS validator when `captchaAction` begins with `/` (silverfire)
- Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark) - Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark)
- Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire) - Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire)
- Enh #3506: Added `yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark) - Enh #3506: Added `yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark)

View File

@ -91,7 +91,7 @@ class CaptchaValidator extends Validator
$hash = $captcha->generateValidationHash($this->caseSensitive ? $code : strtolower($code)); $hash = $captcha->generateValidationHash($this->caseSensitive ? $code : strtolower($code));
$options = [ $options = [
'hash' => $hash, 'hash' => $hash,
'hashKey' => 'yiiCaptcha/' . $this->captchaAction, 'hashKey' => 'yiiCaptcha/' . $captcha->getUniqueId(),
'caseSensitive' => $this->caseSensitive, 'caseSensitive' => $this->caseSensitive,
'message' => Yii::$app->getI18n()->format($this->message, [ 'message' => Yii::$app->getI18n()->format($this->message, [
'attribute' => $object->getAttributeLabel($attribute), 'attribute' => $object->getAttributeLabel($attribute),