Updated login
This commit is contained in:
parent
dcd9253bb9
commit
f9baab3314
|
@ -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)
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue