TOTP endpoint update - support sending code that's less than or equal to 10 chars directly (#2464)
This commit is contained in:
@@ -69,8 +69,20 @@ async def send_totp_code(
|
||||
task_id=data.task_id,
|
||||
workflow_id=data.workflow_id,
|
||||
)
|
||||
code = await parse_totp_code(data.content)
|
||||
content = data.content.strip()
|
||||
code: str | None = content
|
||||
# We assume the user is sending the code directly when the length of code is less than or equal to 10
|
||||
if len(content) > 10:
|
||||
code = await parse_totp_code(content)
|
||||
if not code:
|
||||
LOG.error(
|
||||
"Failed to parse totp code",
|
||||
totp_identifier=data.totp_identifier,
|
||||
task_id=data.task_id,
|
||||
workflow_id=data.workflow_id,
|
||||
workflow_run_id=data.workflow_run_id,
|
||||
content=data.content,
|
||||
)
|
||||
raise HTTPException(status_code=400, detail="Failed to parse totp code")
|
||||
return await app.DATABASE.create_totp_code(
|
||||
organization_id=curr_org.organization_id,
|
||||
|
||||
Reference in New Issue
Block a user