From 15c46384b32189fd60436247d2205a5d8e225254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Farr=C3=A9?= Date: Sun, 3 Nov 2019 13:43:54 +0100 Subject: [PATCH] Update RegistrationController.php After registration, redirect user to the URL he was looking for before signing up. --- .../modules/user/controllers/RegistrationController.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protected/humhub/modules/user/controllers/RegistrationController.php b/protected/humhub/modules/user/controllers/RegistrationController.php index 6157d9c38b..e229218ab5 100644 --- a/protected/humhub/modules/user/controllers/RegistrationController.php +++ b/protected/humhub/modules/user/controllers/RegistrationController.php @@ -77,7 +77,10 @@ class RegistrationController extends Controller if ($registration->getUser()->status === User::STATUS_ENABLED) { Yii::$app->user->switchIdentity($registration->models['User']); $registration->models['User']->updateAttributes(['last_login' => new \yii\db\Expression('NOW()')]); - return $this->redirect(['/']); + if (Yii::$app->request->getIsAjax()) { + return $this->htmlRedirect(Yii::$app->user->returnUrl); + } + return $this->redirect(Yii::$app->user->returnUrl); } return $this->render('success', [