Skip to content

Commit

Permalink
Check if challenge is already approved before raising exception (#5445)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Nov 8, 2024
1 parent f878a3e commit 051e7c5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/dispatch/plugins/dispatch_core/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,9 @@ def validate_mfa_token(
raise ActionMismatchError("Action mismatch")
if not challenge.valid:
raise ExpiredChallengeError("Challenge is no longer valid")
if challenge.status == MfaChallengeStatus.APPROVED:
# Challenge has already been approved
return challenge.status
if challenge.status != MfaChallengeStatus.PENDING:
raise InvalidChallengeStateError(f"Challenge is in invalid state: {challenge.status}")

Expand Down

0 comments on commit 051e7c5

Please sign in to comment.