Oranblock commited on
Commit
e34d7ea
·
verified ·
1 Parent(s): 4ef67a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -196,7 +196,8 @@ def login():
196
  cursor.execute('SELECT id, password, is_admin FROM users WHERE username = ?', (username,))
197
  user = cursor.fetchone()
198
 
199
- if user and bcrypt.checkpw(password.encode('utf-8'), user[1]):session['user_id'] = user[0]
 
200
  session['is_admin'] = user[2]
201
  return jsonify({'message': 'Login successful', 'is_admin': user[2]}), 200
202
  else:
 
196
  cursor.execute('SELECT id, password, is_admin FROM users WHERE username = ?', (username,))
197
  user = cursor.fetchone()
198
 
199
+ if user and bcrypt.checkpw(password.encode('utf-8'), user[1]):
200
+ session['user_id'] = user[0]
201
  session['is_admin'] = user[2]
202
  return jsonify({'message': 'Login successful', 'is_admin': user[2]}), 200
203
  else: