mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 06:48:59 +08:00
Merge pull request #2741 from tonydspaniard/2740-captcha-action-using-obsolete-method
Fixes #2740
This commit is contained in:
@@ -55,6 +55,7 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #2653: Fixed the bug that unsetting an unpopulated AR relation would trigger exception (qiangxue)
|
- Bug #2653: Fixed the bug that unsetting an unpopulated AR relation would trigger exception (qiangxue)
|
||||||
- Bug #2681: Fixed the bug of php build-in server https://bugs.php.net/bug.php?id=66606 (dizews)
|
- Bug #2681: Fixed the bug of php build-in server https://bugs.php.net/bug.php?id=66606 (dizews)
|
||||||
- Bug #2695: Fixed the issue that `FileValidator::isEmpty()` always returns true for validate multiple files (ZhandosKz)
|
- Bug #2695: Fixed the issue that `FileValidator::isEmpty()` always returns true for validate multiple files (ZhandosKz)
|
||||||
|
- Bug #2740: Fixed the issue that `CaptchaAction::run()` was using obsolete `Controller::createUrl()` method (tonydspaniard)
|
||||||
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
|
- Bug: Fixed `Call to a member function registerAssetFiles() on a non-object` in case of wrong `sourcePath` for an asset bundle (samdark)
|
||||||
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
|
- Bug: Fixed incorrect event name for `yii\jui\Spinner` (samdark)
|
||||||
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
|
- Bug: Json::encode() did not handle objects that implement JsonSerializable interface correctly (cebe)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace yii\captcha;
|
|||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\Action;
|
use yii\base\Action;
|
||||||
use yii\base\InvalidConfigException;
|
use yii\base\InvalidConfigException;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CaptchaAction renders a CAPTCHA image.
|
* CaptchaAction renders a CAPTCHA image.
|
||||||
@@ -117,14 +118,12 @@ class CaptchaAction extends Action
|
|||||||
if (Yii::$app->request->getQueryParam(self::REFRESH_GET_VAR) !== null) {
|
if (Yii::$app->request->getQueryParam(self::REFRESH_GET_VAR) !== null) {
|
||||||
// AJAX request for regenerating code
|
// AJAX request for regenerating code
|
||||||
$code = $this->getVerifyCode(true);
|
$code = $this->getVerifyCode(true);
|
||||||
/** @var \yii\web\Controller $controller */
|
|
||||||
$controller = $this->controller;
|
|
||||||
return json_encode([
|
return json_encode([
|
||||||
'hash1' => $this->generateValidationHash($code),
|
'hash1' => $this->generateValidationHash($code),
|
||||||
'hash2' => $this->generateValidationHash(strtolower($code)),
|
'hash2' => $this->generateValidationHash(strtolower($code)),
|
||||||
// we add a random 'v' parameter so that FireFox can refresh the image
|
// we add a random 'v' parameter so that FireFox can refresh the image
|
||||||
// when src attribute of image tag is changed
|
// when src attribute of image tag is changed
|
||||||
'url' => $controller->createUrl([$this->id, 'v' => uniqid()]),
|
'url' => Url::to([$this->id, 'v' => uniqid()]),
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$this->setHttpHeaders();
|
$this->setHttpHeaders();
|
||||||
|
|||||||
Reference in New Issue
Block a user