moved making session permanent to after authentication in web.py

This commit is contained in:
rosechar 2020-04-06 15:34:21 -04:00
parent fef024ac5a
commit 103003302e
2 changed files with 4 additions and 5 deletions

View file

@ -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)

View file

@ -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"))