From f9baab3314f4f293703acb0d44f897e78b8e8f61 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Mon, 20 Nov 2023 17:32:17 +0000 Subject: [PATCH] Updated login --- account/account.py | 9 ++++++++- account/templates/dashboard.html | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/account/account.py b/account/account.py index f56d16f..39d2d01 100644 --- a/account/account.py +++ b/account/account.py @@ -36,8 +36,9 @@ def verify_bcrypt(passphrase, hashed_password): @app.route('/') def index(): + email = request.cookies.get('email') if 'passwordhash' in request.cookies and request.cookies.get('passwordhash'): - return render_template('dashboard.html') + return render_template('dashboard.html', user_email=email) else: return render_template('index.html') @@ -98,5 +99,11 @@ def deleteacct(): else: return redirect(url_for('index')) +@app.route('/logout') + response = make_response(redirect('/')) + response.set_cookie('passwordhash', '', expires=0) + response.set_cookie('email', '', expires=0) + return response + if __name__ == '__main__': serve(app, host='0.0.0.0', port=runport) diff --git a/account/templates/dashboard.html b/account/templates/dashboard.html index 37c2e2b..34a36d8 100644 --- a/account/templates/dashboard.html +++ b/account/templates/dashboard.html @@ -12,8 +12,12 @@

Account management

+ {{ user_email }} +
+
+