From 103003302ef5956febf5c744ecd9b2f5cff9eda5 Mon Sep 17 00:00:00 2001 From: rosechar Date: Mon, 6 Apr 2020 15:34:21 -0400 Subject: [PATCH] moved making session permanent to after authentication in web.py --- ihatemoney/run.py | 5 ----- ihatemoney/web.py | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ihatemoney/run.py b/ihatemoney/run.py index 5f660711..161761c0 100644 --- a/ihatemoney/run.py +++ b/ihatemoney/run.py @@ -147,11 +147,6 @@ def create_app( app.jinja_env.globals["locale_from_iso"] = locale_from_iso app.jinja_env.filters["minimal_round"] = minimal_round - # Set session to permanent to make language choice persist - @app.before_request - def make_session_permanent(): - session.permanent = True - # Translations babel = Babel(app) diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 1b80ab62..4a8b96df 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -190,6 +190,7 @@ def admin(): @main.route("/authenticate", methods=["GET", "POST"]) def authenticate(project_id=None): + print("authenticate") """Authentication form""" form = AuthenticationForm() # Try to get project_id from token first @@ -235,6 +236,8 @@ def authenticate(project_id=None): # add the project on the top of the list session["projects"].insert(0, (project_id, project.name)) session[project_id] = True + # Set session to permanent to make language choice persist + session.permanent = True session.update() setattr(g, "project", project) return redirect(url_for(".list_bills")) @@ -698,6 +701,7 @@ def delete_bill(bill_id): db.session.delete(bill) db.session.commit() + session["recentlyDeletedBill"] = json.loads(bill) flash(_("The bill has been deleted")) return redirect(url_for(".list_bills"))