Skip to content

Commit

Permalink
Added password mismatch check and username exists functionality to cr…
Browse files Browse the repository at this point in the history
…eate account page
  • Loading branch information
JoeArchibold committed Oct 1, 2023
1 parent 16ed296 commit f399bf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 2 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions templates/create-account.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@

<h1>Create an Account</h1>

{% if password_mismatch == True %}
<h2>Passwords do not match</h2>
{% endif %}
{% if username_exists == True %}
<h2>Username already exists</h2>
{% endif %}

<form action="/create-account", method="post">
<label for="first-name">First Name</label>
<input type="text" id="first-name" name="first-name">
Expand Down

0 comments on commit f399bf1

Please sign in to comment.