Updated login
This commit is contained in:
parent
dcd9253bb9
commit
f9baab3314
|
@ -36,8 +36,9 @@ def verify_bcrypt(passphrase, hashed_password):
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
def index():
|
def index():
|
||||||
|
email = request.cookies.get('email')
|
||||||
if 'passwordhash' in request.cookies and request.cookies.get('passwordhash'):
|
if 'passwordhash' in request.cookies and request.cookies.get('passwordhash'):
|
||||||
return render_template('dashboard.html')
|
return render_template('dashboard.html', user_email=email)
|
||||||
else:
|
else:
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
|
@ -98,5 +99,11 @@ def deleteacct():
|
||||||
else:
|
else:
|
||||||
return redirect(url_for('index'))
|
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__':
|
if __name__ == '__main__':
|
||||||
serve(app, host='0.0.0.0', port=runport)
|
serve(app, host='0.0.0.0', port=runport)
|
||||||
|
|
|
@ -12,8 +12,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>Account management</h1>
|
<h1>Account management</h1>
|
||||||
|
<p1>{{ user_email }}</p1>
|
||||||
|
<br>
|
||||||
<button onclick="location.href = '/account/changepass';">Change Password</button>
|
<button onclick="location.href = '/account/changepass';">Change Password</button>
|
||||||
<button onclick="location.href = '/account/deleteacct';">Delete Account</button>
|
<button onclick="location.href = '/account/deleteacct';">Delete Account</button>
|
||||||
|
<br>
|
||||||
|
<button onclick="location.href = '/account/logout';">Logout</button>
|
||||||
</div>
|
</div>
|
||||||
<style type="text/css"></style>
|
<style type="text/css"></style>
|
||||||
</body></html>
|
</body></html>
|
||||||
|
|
Loading…
Reference in New Issue