diff --git a/app.py b/app.py
index 7b31903..2fcd500 100644
--- a/app.py
+++ b/app.py
@@ -23,18 +23,15 @@ with app.app_context():
def handle_submission():
form_username = request.form.get('username')
form_email = request.form.get('email')
- form_password = request.form.get('password') # 1. Grab password from HTML
+ form_password = request.form.get('password')
- # Check for duplicates
if User.query.filter_by(username=form_username).first():
return "
Username taken!
", 400
if User.query.filter_by(email=form_email).first():
return "Email already registered!
", 400
- # 2. Hash the password into a secure scramble
hashed_password = generate_password_hash(form_password)
- # 3. Save the user with the scrambled hash
new_user = User(username=form_username, email=form_email, password_hash=hashed_password)
db.session.add(new_user)
db.session.commit()
@@ -47,10 +44,8 @@ def success():
@app.route('/users')
def view_users():
- # Fetch all user records from the database
all_users = User.query.all()
- # Create a simple HTML table to display them nicely
html_output = "Registered Accounts
"
html_output += "| ID | Username | Email |
"
@@ -59,7 +54,6 @@ def view_users():
html_output += "
"
- # If the database is completely empty
if not all_users:
return "No accounts found in the database yet.
"