Updated login

This commit is contained in:
Tracker-Friendly 2023-11-20 17:32:17 +00:00
parent dcd9253bb9
commit f9baab3314
2 changed files with 12 additions and 1 deletions

View File

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

View File

@ -12,8 +12,12 @@
</div>
<div class="content">
<h1>Account management</h1>
<p1>{{ user_email }}</p1>
<br>
<button onclick="location.href = '/account/changepass';">Change Password</button>
<button onclick="location.href = '/account/deleteacct';">Delete Account</button>
<br>
<button onclick="location.href = '/account/logout';">Logout</button>
</div>
<style type="text/css"></style>
</body></html>