Skip to content

Commit

Permalink
Update auth.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Stiveknx authored Feb 10, 2022
1 parent fa59fca commit 90a2b23
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
responses={404: {"description": "Not found"}}
)


def challenge_code_handler(username, choice):
return False

@router.post("/login")
async def auth_login(username: str = Form(...),
password: str = Form(...),
Expand All @@ -20,6 +24,8 @@ async def auth_login(username: str = Form(...),
"""Login by username and password with 2FA
"""
cl = clients.client()
cl.challenge_code_handler = challenge_code_handler

if proxy != "":
cl.set_proxy(proxy)

Expand Down Expand Up @@ -49,6 +55,16 @@ async def auth_relogin(sessionid: str = Form(...),
result = cl.relogin()
return result

@router.post("/challenge_code")
async def challenge_choice(sessionid: str = Form(...),
code: str = Form(...),
clients: ClientStorage = Depends(get_clients)) -> str:
""" Challenge code
"""
cl = clients.get(sessionid)
# HERE, we would need to "resume" the previous challenge. How we would do that?
return result


@router.get("/settings/get")
async def settings_get(sessionid: str,
Expand Down

0 comments on commit 90a2b23

Please sign in to comment.