From 6d6f8c1b1f8ed061e73343e3c70b87ec41339c54 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Sun, 7 Jul 2024 15:53:26 +0200 Subject: [PATCH] Update redirect for login/logout in case of anonymous browsing enabled --- cps/templates/layout.html | 8 ++++---- cps/web.py | 9 ++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cps/templates/layout.html b/cps/templates/layout.html index 1bee1c1d..ff1c3687 100644 --- a/cps/templates/layout.html +++ b/cps/templates/layout.html @@ -62,13 +62,13 @@ {% if g.current_theme == 1 %} @@ -91,9 +91,9 @@
  • {% endif %} {% if g.current_theme == 0 %} -
  • +
  • {% if not current_user.is_anonymous %} -
  • +
  • {% endif %} {% endif %} {% endif %} diff --git a/cps/web.py b/cps/web.py index 3e0fce9a..b53fe421 100644 --- a/cps/web.py +++ b/cps/web.py @@ -1451,7 +1451,14 @@ def logout(): if feature_support['oauth'] and (config.config_login_type == 2 or config.config_login_type == 3): logout_oauth_user() log.debug("User logged out") - return redirect(url_for('web.login')) + if config.config_anonbrowse: + location = get_redirect_location(request.args.get('next', None), "web.login") + else: + location = None + if location: + return redirect(location) + else: + return redirect(url_for('web.login')) # ################################### Users own configuration #########################################################