Skip to content

Commit

Permalink
В HttpRequest->noCsrfValidationRoutes теперь передаются роуты, а не у…
Browse files Browse the repository at this point in the history
…рлы.

site/welcome -> site/index
  • Loading branch information
chemezov committed Feb 26, 2015
1 parent dd5f0b6 commit 83d041b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
- #1847: Добавлена возможность сортировки товаров (@yupe)
- #1855: Исправлено округление цены на фронтенде (@sabian)
- #1858: В список товаров в админке добавлены поля скидок (@yupe, @sabian, @Dark_cs)
- #1817: Добавлены дефолтные для CRUD операций экшены (@chemezov)
- #1817: Добавлены дефолтные для CRUD операций экшены (@chemezov)
- #1827: В HttpRequest->noCsrfValidationRoutes теперь передаются роуты, а не урлы (@vv3d0x, @chemezov)

Версия 0.9.3 10 февраля 2015
-------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion protected/controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SiteController extends FrontController
*/
public function actionIndex()
{
$this->render('welcome');
$this->render('index');
}

/**
Expand Down
9 changes: 6 additions & 3 deletions protected/modules/yupe/components/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @package yupe.modules.yupe.components
* @author AKulikov <[email protected]>
* @license BSD https://raw.github.com/yupe/yupe/master/LICENSE
* @version 0.0.1
* @version 0.9.4
* @link http://yupe.ru
**/

Expand All @@ -31,9 +31,12 @@ protected function normalizeRequest()
{
parent::normalizeRequest();

if ($this->enableCsrfValidation) {
if ($this->enableCsrfValidation && !empty($this->noCsrfValidationRoutes)) {
// for fixing csrf validation disabling
$url = Yii::app()->getUrlManager()->parseUrl($this);

foreach ($this->noCsrfValidationRoutes as $route) {
if (strpos($this->pathInfo, $route) === 0) {
if (strpos($url, trim($route, '/')) === 0) {
Yii::app()->detachEventHandler('onBeginRequest', [$this, 'validateCsrfToken']);
}
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 83d041b

Please sign in to comment.