From 23d4fe44e8e42d5b3976516128792ccccd92df10 Mon Sep 17 00:00:00 2001 From: fram3d Date: Wed, 1 Nov 2023 16:11:38 +0100 Subject: [PATCH] add confirm password field --- luser/routes.py | 5 +++++ luser/templates/register.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/luser/routes.py b/luser/routes.py index a975f73..c456aca 100644 --- a/luser/routes.py +++ b/luser/routes.py @@ -91,6 +91,7 @@ def register(): elif request.method == 'POST': username = request.form['username'] password = request.form['password'] + confirmpassword = request.form['confirmpassword'] captcha_answer = request.form['captchaa'] captcha_filename = request.form['captchaq'] captcha_path = CAPTCHA_PATH + captcha_filename @@ -117,6 +118,10 @@ def register(): if len(password) < 8: return 'Error: password is too short' + # Check lenght of password + if password != confirmpassword: + return 'Error: passwords do not match' + # Check if username has uppercase if username.islower() == False: return 'Error: uppercase characters in username are not allowed' diff --git a/luser/templates/register.html b/luser/templates/register.html index 87267b8..57e9b8c 100644 --- a/luser/templates/register.html +++ b/luser/templates/register.html @@ -17,6 +17,8 @@ + +

password must be at least 8 characters long


{{ captchahash }}