Updated account

This commit is contained in:
Tracker-Friendly 2023-11-20 18:17:33 +00:00
parent 0adabf3195
commit 1f389e1239
2 changed files with 14 additions and 16 deletions

View File

@ -161,12 +161,12 @@ 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
@ -178,8 +178,6 @@ def register():
return render_template('err.html'), 500 return render_template('err.html'), 500
else: else:
return render_template('wrong.html'), 400 return render_template('wrong.html'), 400
else:
return render_template('wrong.html'), 400
if __name__ == '__main__': if __name__ == '__main__':
serve(app, host='0.0.0.0', port=runport) serve(app, host='0.0.0.0', port=runport)

View File

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