make it cuter
This commit is contained in:
parent
8c270bd24b
commit
8577b2fcbc
1 changed files with 3 additions and 3 deletions
|
@ -57,13 +57,13 @@ def login():
|
||||||
password = encrypt(request.form['password'])
|
password = encrypt(request.form['password'])
|
||||||
|
|
||||||
user = db.execute(text("SELECT * FROM users WHERE username = :username AND password = :password"),
|
user = db.execute(text("SELECT * FROM users WHERE username = :username AND password = :password"),
|
||||||
{"username": username, "password": password}).fetchone()
|
{"username": username, "password": password}).fetchone()
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
session['user_id'] = user.id
|
session['user_id'] = user.id
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
else:
|
else:
|
||||||
return "Invalid credentials!"
|
return "invalid credentials 😾"
|
||||||
return render_template('login.j2', instanceLocation=instanceLocation, instanceBranding=instanceBranding)
|
return render_template('login.j2', instanceLocation=instanceLocation, instanceBranding=instanceBranding)
|
||||||
|
|
||||||
@app.route('/auth/register/', methods=['GET', 'POST'])
|
@app.route('/auth/register/', methods=['GET', 'POST'])
|
||||||
|
@ -77,7 +77,7 @@ def register():
|
||||||
existing_user = db.execute(text("SELECT * FROM users WHERE username = :username"),
|
existing_user = db.execute(text("SELECT * FROM users WHERE username = :username"),
|
||||||
{"username": username}).fetchone()
|
{"username": username}).fetchone()
|
||||||
if existing_user:
|
if existing_user:
|
||||||
return "User already exists!"
|
return "that user already exists 😾"
|
||||||
|
|
||||||
# insert new user
|
# insert new user
|
||||||
db.execute(text("INSERT INTO users (username, password) VALUES (:username, :password)"),
|
db.execute(text("INSERT INTO users (username, password) VALUES (:username, :password)"),
|
||||||
|
|
Loading…
Add table
Reference in a new issue