Skip to content

Commit

Permalink
优化登录提示
Browse files Browse the repository at this point in the history
  • Loading branch information
F-19-F committed May 19, 2021
1 parent 68de9af commit 66bda16
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,19 @@ def Login(user, School_Server_API):
continue
Params['captcha'] = code
res = session.post(PostUrl,data=Params,headers=LoginHeaders,allow_redirects=False)
if 'Location' in res.headers:
# 验证码登录成功
if 'Location' in res.headers or res.json()['resultCode'] == 'FAIL_UPNOTMATCH':
# 验证码登录成功或者密码错误
break
if i == MAX_Captcha_Times-1:
Util.log("验证码识别超过最大次数")
else:
res = session.post(PostUrl,data=Params,headers=LoginHeaders,allow_redirects=False)
if 'Location' not in res.headers:
reason=res.json()['resultCode']
if reason == 'FORCE_MOD_PASS':
Util.log("请重置密码后重试!")
elif reason == 'FAIL_UPNOTMATCH':
Util.log("用户名或密码错误!")
Util.log("登录失败")
return None
nexturl = res.headers['Location']
Expand Down

0 comments on commit 66bda16

Please sign in to comment.