-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a null check to getMfaChallengeResponse
#50570
base: master
Are you sure you want to change the base?
Conversation
@@ -69,7 +69,7 @@ export function parseMfaChallengeJson( | |||
!challenge.webauthn_challenge && | |||
!challenge.totp_challenge | |||
) { | |||
return null; | |||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the return type of this function be MfaAuthenciateChallenge | undefined
?
We don't have strict null checks enabled right now, but if we did this would not compile as-is.
@@ -282,6 +282,8 @@ const auth = { | |||
mfaType?: DeviceType, | |||
totpCode?: string | |||
): Promise<MfaChallengeResponse> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps?
): Promise<MfaChallengeResponse> { | |
): Promise<MfaChallengeResponse|undefined> { |
@@ -282,6 +282,8 @@ const auth = { | |||
mfaType?: DeviceType, | |||
totpCode?: string | |||
): Promise<MfaChallengeResponse> { | |||
if (!challenge) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We return undefined here, but null on line 315. Can we be more consistent and explicit about the behavior?
Changelog: Fix a bug in the WebUI for some MFA actions for users with no MFA devices, or where MFA is not required for the user.
Fix a bug caused by #49679 which was meant to check for null/undefined.
Closes #50556