From 1a4d88e97d85f28953bdd31f9b33a58527eae145 Mon Sep 17 00:00:00 2001 From: lesteenman Date: Wed, 31 Dec 2025 20:34:12 +0100 Subject: [PATCH] Sets login sessions to permanent for longer login sessions This change makes it so Flask's session cookie is stored with an explicit expiration date. This means that, rather than the login expiring after the browser closes (expiration = 'Session'), it expires on an explicit date. By default, 31 days. --- taskapp.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taskapp.py b/taskapp.py index 0af4aaa..8166d16 100644 --- a/taskapp.py +++ b/taskapp.py @@ -155,7 +155,7 @@ def api_completed_tasks(username): 'master' : user_data.master.completed_tasks, 'passive' : user_data.passive.completed_tasks, 'pets' : user_data.pets.completed_tasks, - 'extra' : user_data.extra.completed_tasks + 'extra' : user_data.extra.completed_tasks }}) def token_required(f): @@ -371,6 +371,7 @@ def login(): if username_found: passwordcheck = username_found['hashed_password'] if bcrypt.checkpw(attempted_password.encode('utf-8'), passwordcheck): + session.permanent = True session['logged_in'] = True session['username'] = request.form['username'] return redirect(url_for('dashboard')) @@ -1111,4 +1112,4 @@ def change_official_status(): if (isProd): app.run(host='0.0.0.0') else: - app.run(host="0.0.0.0", port=5001) \ No newline at end of file + app.run(host="0.0.0.0", port=5001)