Skip to content

Commit

Permalink
fix: Fixed try block on login route
Browse files Browse the repository at this point in the history
  • Loading branch information
CamilaNieto-Centennial committed Nov 1, 2024
1 parent 3daa11a commit 6b2588b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ def login():
return apology("must provide password", 403)

# Query database for username
rows = db.execute("SELECT * FROM users WHERE username = ?", request.form.get("username"))
try:
rows = db.execute("SELECT * FROM users WHERE username = ?", request.form.get("username"))
except Exception as e:
db.session.rollback() # Rollback the transaction if there's an error
print(f"Database error during login: {e}")
Expand Down

0 comments on commit 6b2588b

Please sign in to comment.