From f399bf12f8fca68f15e93c460ace2208ae5f565e Mon Sep 17 00:00:00 2001 From: JoeArchibold Date: Sun, 1 Oct 2023 14:38:13 -0600 Subject: [PATCH] Added password mismatch check and username exists functionality to create account page --- app.py | 6 ++---- templates/create-account.html | 7 +++++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index de665b2..c83283e 100644 --- a/app.py +++ b/app.py @@ -106,14 +106,12 @@ def createAccount(): username = request.form['username'].lower() if(db.users.find_one({'username': username})): - #TODO - pass + return render_template("create-account.html", username_exists=True) password = request.form['password'] if(password != request.form['password-confirm']): - #TODO - pass + return render_template("create-account.html", password_mismatch=True) salt = os.urandom(32) diff --git a/templates/create-account.html b/templates/create-account.html index 59aa55d..b72de85 100644 --- a/templates/create-account.html +++ b/templates/create-account.html @@ -64,6 +64,13 @@

Create an Account

+ {% if password_mismatch == True %} +

Passwords do not match

+ {% endif %} + {% if username_exists == True %} +

Username already exists

+ {% endif %} +