Enh #6458: Redirect to the latest-visited page after login or registr… (#6459)

* Enh #6458: Redirect to the latest-visited page after login or registration

* Only for ajax

* Store Return URL

---------

Co-authored-by: Lucas Bartholemy <lucas@bartholemy.com>
This commit is contained in:
Marc Farré 2023-07-26 10:43:15 +02:00 committed by GitHub
parent f4d86ef2fd
commit 1cc8a9413e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 0 deletions

View File

@ -87,3 +87,4 @@ HumHub Changelog
- Chg #6174: Users allowed to manage settings can access to module configurations
- Enh #6440: Sort user groups by `group.sort_order` and alphabetically
- Enh #6454: Account deletion confirmation
- Enh #6458: Redirect to the latest-visited page after login or registration

View File

@ -53,6 +53,7 @@ class ErrorController extends Controller
* Show special login required view for guests
*/
if (Yii::$app->user->isGuest && $exception instanceof HttpException && $exception->statusCode == '401' && AuthHelper::isGuestAccessEnabled()) {
Yii::$app->user->setReturnUrl(Yii::$app->request->getAbsoluteUrl());
return $this->render('@humhub/views/error/401_guests', ['message' => $message]);
}