From e1a6aacba8ac4b19c95d716a74f1da5db35d5ca7 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 30 Aug 2013 18:22:53 +0400 Subject: [PATCH] Fixes #829: loginRequired now responds with HTTP 403 in case of AJAX or loginUrl is not set (reverted from commit c2c12a9049ec321e77ee13bc7f8a9a8293596b21) --- framework/yii/web/User.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/yii/web/User.php b/framework/yii/web/User.php index 4784063..b1ca8c2 100644 --- a/framework/yii/web/User.php +++ b/framework/yii/web/User.php @@ -287,8 +287,10 @@ class User extends Component public function loginRequired() { $request = Yii::$app->getRequest(); - if ($this->loginUrl !== null && !$request->getIsAjax()) { + if (!$request->getIsAjax()) { $this->setReturnUrl($request->getUrl()); + } + if ($this->loginUrl !== null) { Yii::$app->getResponse()->redirect($this->loginUrl)->send(); exit(); } else {