add confirm password field

This commit is contained in:
fram3d 2023-11-01 16:11:38 +01:00
parent d0ba096710
commit 23d4fe44e8
Signed by: fram3d
GPG Key ID: 938920E709EEA32A
2 changed files with 7 additions and 0 deletions

View File

@ -91,6 +91,7 @@ def register():
elif request.method == 'POST': elif request.method == 'POST':
username = request.form['username'] username = request.form['username']
password = request.form['password'] password = request.form['password']
confirmpassword = request.form['confirmpassword']
captcha_answer = request.form['captchaa'] captcha_answer = request.form['captchaa']
captcha_filename = request.form['captchaq'] captcha_filename = request.form['captchaq']
captcha_path = CAPTCHA_PATH + captcha_filename captcha_path = CAPTCHA_PATH + captcha_filename
@ -117,6 +118,10 @@ def register():
if len(password) < 8: if len(password) < 8:
return 'Error: password is too short' return 'Error: password is too short'
# Check lenght of password
if password != confirmpassword:
return 'Error: passwords do not match'
# Check if username has uppercase # Check if username has uppercase
if username.islower() == False: if username.islower() == False:
return 'Error: uppercase characters in username are not allowed' return 'Error: uppercase characters in username are not allowed'

View File

@ -17,6 +17,8 @@
<input type="text" name="username" id="username" placeholder="username" required> <input type="text" name="username" id="username" placeholder="username" required>
<label for="password">password</label> <label for="password">password</label>
<input type="password" name="password" id="password" placeholder="password" required> <input type="password" name="password" id="password" placeholder="password" required>
<label for="confirmpassword">password</label>
<input type="confirmpassword" name="confirmpassword" id="confirmpassword" placeholder="confirmpassword" required>
<p>password must be at least 8 characters long<p> <p>password must be at least 8 characters long<p>
<br> <br>
<img src=/account/register/captcha_img/{{ imgsrc }} alt="{{ captchahash }}" style="width:200;margin:auto;"> <img src=/account/register/captcha_img/{{ imgsrc }} alt="{{ captchahash }}" style="width:200;margin:auto;">