From 52a8f417adc0dd25062d0c37fe5a6f1434ae2a7c Mon Sep 17 00:00:00 2001 From: "create-issue-branch[bot]" <53036503+create-issue-branch[bot]@users.noreply.github.com> Date: Sat, 1 May 2021 23:51:17 +0200 Subject: [PATCH] Bug: logging in after clearing session redirects to clearing session (#112) Prevent user from being logged out when clearing the session. * Create draft PR for #28 * More session keys to avoid clearing * Changelog entry Co-authored-by: Flix6x Co-authored-by: F.N. Claessen Co-authored-by: Felix Claessen <30658763+Flix6x@users.noreply.github.com> --- documentation/changelog.rst | 4 ++++ flexmeasures/ui/utils/view_utils.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index d5a24a9a5..5fef02082 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -10,6 +10,10 @@ New features ----------- * Allow plugins to overwrite UI routes and customise the teaser on the login form [see `PR #106 `_] +Bugfixes +----------- +* Prevent logging out user when clearing the session [see `PR #112 `_] + Infrastructure / Support ---------------------- * Make assets use MW as their default unit and enforce that in CLI, as well (API already did) [see `PR #108 `_] diff --git a/flexmeasures/ui/utils/view_utils.py b/flexmeasures/ui/utils/view_utils.py index 50f9674f2..8e6c83cc3 100644 --- a/flexmeasures/ui/utils/view_utils.py +++ b/flexmeasures/ui/utils/view_utils.py @@ -91,7 +91,9 @@ def render_flexmeasures_template(html_filename: str, **variables): def clear_session(): for skey in [ - k for k in session.keys() if k not in ("_id", "user_id", "csrf_token") + k + for k in session.keys() + if k not in ("_fresh", "_id", "_user_id", "csrf_token", "fs_cc", "fs_paa") ]: current_app.logger.info( "Removing %s:%s from session ... " % (skey, session[skey])