def request_loader(request):
email = request.form.get('email')
cur.execute("""SELECT sid from students where email = %s;""", (email,))
lst = cur.fetchall()
print("IN request_loader: THIS IS THE lst RESULT (before init return): ", str(lst))
if len(lst) == 0:
return
user = User()
sid = lst[0][0]
user.id = sid
print("IN request_loader: THIS IS THE sid RESULT: ", str(sid))
cur.execute("""SELECT hashpswd from students where email = %s;""", (email,))
lst = cur.fetchall()
conn.commit()
print("IN request_loader: THIS IS THE lst RESULT: ", str(lst), "AND THE hashpswd RESULT: ", str(lst[0][0]))
user.is_authenticated = check_password_hash(lst[0][0], request.form['pw'])
return user
## SECURITY V2 ##SV2##(2-E)
# Function used to generate password hash with the werkzeug.security package
评论列表
文章目录