Skip to content

Commit 8ea463f

Browse files
authored
Merge pull request #73 from kevinkavaliauskas/main
Use passed verification code
2 parents 8fd8c2c + c5323f9 commit 8ea463f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

routers/auth.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,17 @@ async def auth_login(username: str = Form(...),
3131
if timezone != "":
3232
cl.set_timezone_offset(timezone)
3333

34-
# We're mocking the input
35-
with patch('builtins.input', return_value=verification_code):
34+
# Handle 2FA if verification code is provided
35+
if verification_code:
36+
# Try login with 2FA code directly
37+
try:
38+
result = cl.login(username, password, verification_code=verification_code)
39+
except TypeError:
40+
# Fallback to mocking input if the direct parameter doesn't work
41+
with patch('builtins.input', return_value=verification_code):
42+
result = cl.login(username, password)
43+
else:
44+
# Regular login without 2FA
3645
result = cl.login(username, password)
3746

3847
if result:

0 commit comments

Comments
 (0)