def loginStudent():
email = request.args['email']
myemail = email.replace('%40', "@")
password = request.args['hp']
cur.execute("""SELECT * from students where email = %s;""", (myemail,))
lst = cur.fetchall()
conn.commit()
if len(lst) == 0:
return "Please create a student account first"
cur.execute("""SELECT hashpswd from students where email = %s;""", (email,))
lst = cur.fetchall()
conn.commit()
if check_password_hash(lst[0][0], password):
cur.execute("""SELECT sid from students where email = %s;""", (email,))
lst = cur.fetchall()
conn.commit()
return redirect("/games/"+str(lst[0][0]))
if not check_password_hash(lst[0][0], password):
return "Password is wrong. Shame on you."
return "Student account does not exist yet"
评论列表
文章目录