Skip to content

Commit

Permalink
usuername is taken in as a tuple, added a comma to prevent this
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmaclaren committed Mar 24, 2024
1 parent 58e1bad commit 9a83251
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, session
from flask import Flask, render_template, request, session, redirect
from helpers import login_required
from werkzeug.security import check_password_hash, generate_password_hash
import sqlite3
Expand Down Expand Up @@ -35,7 +35,7 @@ def register():
return apology("passwords must match", 400)

rows = db.execute(
"SELECT * FROM users WHERE username = ?", request.form.get("username")
"SELECT * FROM users WHERE username = ?", (request.form.get("username"),)
)

if len(rows) >= 1:
Expand Down
4 changes: 2 additions & 2 deletions templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<form action="/login" method="post">
<div class="py-1 text-center">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control mx-auto w-auto" id="exampleInputEmail1" aria-describedby="emailHelp">
<input type="email" class="form-control mx-auto w-auto" id="username" aria-describedby="emailHelp">
</div>
<div class="py-1 text-center">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control mx-auto w-auto" id="exampleInputPassword1">
<input type="password" class="form-control mx-auto w-auto" id="password">
</div>
<div class="py-3 text-center">
<button type="submit" class="btn btn-primary">Submit</button>
Expand Down
6 changes: 3 additions & 3 deletions templates/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
{% block main %}
<form action="/register" method="post">
<div class="py-1 text-center">
<label for="Username">Email address</label>
<label for="username">Email address</label>
<input autocomplete="off" autofocus class="form-control mx-auto w-auto" name="username" type="text">
</div>
<div class="py-1 text-center">
<label for="Password">Password</label>
<label for="password">Password</label>
<input class="form-control mx-auto w-auto" name="password" type="password">
</div>
<div class="py-1 text-center">
<label for="Confirmation">Confirmation</label>
<label for="confirmation">Confirmation</label>
<input class="form-control mx-auto w-auto" name="confirmation" type="password">
</div>
<div class="py-3 text-center">
Expand Down

0 comments on commit 9a83251

Please sign in to comment.