From b22f4d4cf81a1861647e40c367ea7e52e119a31c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=96=D0=B0=D0=BA=D0=BE=D0=B2=20=D0=92=D0=B8=D1=82=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D0=B9=20=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B5=D0=B2?= =?UTF-8?q?=D0=B8=D1=87?= Date: Thu, 13 Oct 2016 12:26:03 +0500 Subject: [PATCH] Disable start session for anonymous --- src/ServiceBase.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ServiceBase.php b/src/ServiceBase.php index 45b9b38..9d2116c 100644 --- a/src/ServiceBase.php +++ b/src/ServiceBase.php @@ -130,7 +130,13 @@ public function init() { parent::init(); - $this->setRedirectUrl(Yii::$app->getUser()->getReturnUrl()); + //Disable start session for anonymous https://github.com/Nodge/yii2-eauth/issues/96 + if (Yii::$app->session->hasSessionId) { + $returnUrl = Yii::$app->getUser()->getReturnUrl(); + } else { + $returnUrl = Url::to(); + } + $this->setRedirectUrl($returnUrl); $service = Yii::$app->getRequest()->getQueryParam('service'); $cancelUrl = Url::to(['', 'service' => $service], true);