From b8fbe9048fef81d48b7ee63f8c3ee1fe4c94bcf1 Mon Sep 17 00:00:00 2001 From: Max Karas Date: Wed, 8 Nov 2017 05:44:32 +0200 Subject: [PATCH 1/2] if user isGuest goHome --- controllers/UserController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/controllers/UserController.php b/controllers/UserController.php index 4ec5bf3..aa45da7 100644 --- a/controllers/UserController.php +++ b/controllers/UserController.php @@ -130,6 +130,9 @@ public function actionResetPassword($token) public function actionProfile() { + if (\Yii::$app->user->isGuest) { + return $this->goHome(); + } $model = Yii::$app->user->identity; $changePasswordForm = new ChangePasswordForm; $changeEmailForm = new ChangeEmailForm; From 3af94636bd0ce6d13961072c56d5987f58df79d3 Mon Sep 17 00:00:00 2001 From: Max Karas Date: Wed, 8 Nov 2017 06:22:28 +0200 Subject: [PATCH 2/2] if user isGuest go to login page --- controllers/UserController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/UserController.php b/controllers/UserController.php index aa45da7..436b4f8 100644 --- a/controllers/UserController.php +++ b/controllers/UserController.php @@ -131,7 +131,7 @@ public function actionResetPassword($token) public function actionProfile() { if (\Yii::$app->user->isGuest) { - return $this->goHome(); + return $this->redirect(Url::toRoute('/login')); } $model = Yii::$app->user->identity; $changePasswordForm = new ChangePasswordForm;