Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sign_in(email, password):
- conn = get_db()
- cur = conn.cursor()
- password = hashing(password)
- print email
- cur.execute('select email from user where email =?', (email,))
- x = cur.fetchone()
- print 'b'
- cur.execute('select password from user where email =?', (email,))
- y = cur.fetchone()
- print 'c'
- if x is not None and y is not None and y[0] == password:
- token = randomtoken()
- cur.execute('insert into token (email) values (?)', (email,))
- cur.execute('update token set token =? where email =?', (token, email))
- conn.commit()
- return jsonify({'success' : 'true', 'message' : 'Successfully signed in.', 'token' : token})
- return jsonify({'success' : 'false', 'message' : 'Wrong username or password.'})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement