Updated account
This commit is contained in:
parent
0adabf3195
commit
1f389e1239
|
@ -161,23 +161,21 @@ def changepass():
|
||||||
def register():
|
def register():
|
||||||
# Get the form data
|
# Get the form data
|
||||||
username = request.form.get('username')
|
username = request.form.get('username')
|
||||||
passwordhash = request.form.get('passwordhash')
|
verifyhash = request.form.get('passwordhash')
|
||||||
password = request.form.get('password')
|
password = request.form.get('password')
|
||||||
|
|
||||||
if passwordhash:
|
passwordhash = fetch_hash_from_database(key_to_fetch)
|
||||||
is_password_valid = verify_bcrypt(password_to_check, passwordhash)
|
|
||||||
if is_password_valid:
|
if password == passwordhash:
|
||||||
# Attempt to change the password
|
# Attempt to change the password
|
||||||
if change_email_password(username, password):
|
if change_email_password(username, password):
|
||||||
# Password changed
|
# Password changed
|
||||||
response.set_cookie('passwordhash', '', expires=0)
|
response.set_cookie('passwordhash', '', expires=0)
|
||||||
response.set_cookie('email', '', expires=0)
|
response.set_cookie('email', '', expires=0)
|
||||||
return redirect('/account')
|
return redirect('/account')
|
||||||
else:
|
|
||||||
# Backend error, potentially maddy
|
|
||||||
return render_template('err.html'), 500
|
|
||||||
else:
|
else:
|
||||||
return render_template('wrong.html'), 400
|
# Backend error, potentially maddy
|
||||||
|
return render_template('err.html'), 500
|
||||||
else:
|
else:
|
||||||
return render_template('wrong.html'), 400
|
return render_template('wrong.html'), 400
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<h1>Change your password</h1>
|
<h1>Change your password</h1>
|
||||||
<br>
|
<br>
|
||||||
<form method="POST" action="/account/changeapi">
|
<form method="POST" style="display: inline;" action="/account/changeapi">
|
||||||
<input type="hidden" name="email" style="display: inline;" value="{{ user_email }}">
|
<input type="hidden" name="email" value="{{ user_email }}">
|
||||||
<input type="hidden" name="passwordhash" value="{{ password_hash }}">
|
<input type="hidden" name="passwordhash" value="{{ password_hash }}">
|
||||||
<input name="password" required="">
|
<input name="password" required="">
|
||||||
<input type="submit" value="Confirm">
|
<input type="submit" value="Confirm">
|
||||||
|
|
Loading…
Reference in New Issue