Skip to content

Commit

Permalink
fix(apiHandler): fix if err in login_request
Browse files Browse the repository at this point in the history
  • Loading branch information
musnows committed May 28, 2023
1 parent 3d178b2 commit 946833e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions code/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ async def post_shop(request:web_request.Request):
content_type='application/json',status=200)
# 画图请求,不需要检测token速率
ret = await ApiHandler.shop_get_request(params,params['account'])
_log.info(f"/shop return | {ret['code']} | {ret['message']}")
return web.Response(body=json.dumps(ret, indent=2, sort_keys=True, ensure_ascii=False),
content_type='application/json',status=200)
except:
Expand Down
6 changes: 5 additions & 1 deletion code/pkg/utils/api/ApiHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,12 @@ async def login_request(request:web_request.Request,method = "GET"):
# 缓存
await AuthCache.cache_auth_object('api',account,auth)
# 没有成功,是2fa用户,需要执行/tfa
if not resw['status']:
if not resw['status'] and resw['2fa_status']:
_log.info(f"/login return | waiting for post /tfa")
return {'code': 0, 'message': "need provide email verify code", 'info': '2fa用户,请使用/tfa接口提供邮箱验证码'}
else:
_log.info(f"/login return | unkown err")
return {'code': 200, 'message': "unkown err", 'info': '执行authorize函数时出现了未知错误'}

except EzAuthExp.RatelimitError as result:
_log.exception(f"Api login | RatelimitError")
Expand Down
2 changes: 1 addition & 1 deletion code/pkg/utils/valorant/EzAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async def authorize(self, username, password) -> dict:
"""Authenticate using username and password.\n
if username & password empty, using cookie reauth\n
Return:
- {"status":True,"auth":self,"2fa":self.is2fa}
- {"status":True,"auth":self,"2fa_status":self.is2fa}
- {"status":False,"auth":self,"2fa_status":self.is2fa}
- if False, using email_verify() to send verify code
"""
Expand Down

0 comments on commit 946833e

Please sign in to comment.