mirror of
https://github.com/aaronleetw/Attendance.git
synced 2024-11-14 19:11:39 -08:00
Show log
This commit is contained in:
parent
e5f79463ae
commit
9aefbb7d20
1 changed files with 7 additions and 3 deletions
10
app.py
10
app.py
|
@ -52,11 +52,13 @@ def index():
|
||||||
return render_template('login.html')
|
return render_template('login.html')
|
||||||
return redirect('/manage')
|
return redirect('/manage')
|
||||||
elif request.method == 'POST':
|
elif request.method == 'POST':
|
||||||
|
email = request.form['username'] + "@group-attendance.fhjh.tp.edu.tw"
|
||||||
if check_login_status():
|
if check_login_status():
|
||||||
try:
|
try:
|
||||||
if (verify_recaptcha(request.form['g-recaptcha-response'])):
|
if (verify_recaptcha(request.form['g-recaptcha-response'])):
|
||||||
user = auth.sign_in_with_email_and_password(
|
user = auth.sign_in_with_email_and_password(
|
||||||
request.form['username'] + "@group-attendance.fhjh.tp.edu.tw", request.form['password'])
|
email, request.form['password'])
|
||||||
|
print("Login SUCC:", email, flush=True)
|
||||||
session['is_logged_in'] = True
|
session['is_logged_in'] = True
|
||||||
session['email'] = user['email']
|
session['email'] = user['email']
|
||||||
session['uid'] = user['localId']
|
session['uid'] = user['localId']
|
||||||
|
@ -65,13 +67,15 @@ def index():
|
||||||
session['loginTime'] = datetime.now(tz)
|
session['loginTime'] = datetime.now(tz)
|
||||||
return redirect('/manage')
|
return redirect('/manage')
|
||||||
else:
|
else:
|
||||||
|
print("ReC Error:", email, flush=True)
|
||||||
flash(
|
flash(
|
||||||
'reCAPTCHA 錯誤,請稍後再試一次<br>reCAPTCHA Failed. Please try again later.')
|
'reCAPTCHA 錯誤,請稍後再試一次<br>reCAPTCHA Failed. Please try again later.')
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
flash(
|
print("Error:", email, str(e), flush=True)
|
||||||
|
flash(
|
||||||
'帳號或密碼錯誤,請重新輸入<br>Incorrect username or password')
|
'帳號或密碼錯誤,請重新輸入<br>Incorrect username or password')
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
else:
|
else:
|
||||||
return redirect('/manage')
|
return redirect('/manage')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue