-
Notifications
You must be signed in to change notification settings - Fork 1
Render MFA alternatives on external action waiting screen #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,55 @@ | ||
| import { useSlot } from "../appearance/context"; | ||
| import { useLocalization } from "../localization/context"; | ||
| import { FingerprintIcon, KeyIcon, SmartphoneIcon } from "./icons"; | ||
| import type { MFAOption, MFAType } from "../lib/types"; | ||
| import { Button } from "./primitives/Button"; | ||
| import { | ||
| FingerprintIcon, | ||
| KeyIcon, | ||
| MailIcon, | ||
| PhoneIcon, | ||
| RepeatIcon, | ||
| ShieldCheckIcon, | ||
| SmartphoneIcon, | ||
| } from "./icons"; | ||
|
|
||
| function getMFAIcon(type: MFAType) { | ||
| switch (type) { | ||
| case "sms": | ||
| return <SmartphoneIcon />; | ||
| case "call": | ||
| return <PhoneIcon />; | ||
| case "email": | ||
| return <MailIcon />; | ||
| case "totp": | ||
| return <KeyIcon />; | ||
| case "push": | ||
| return <ShieldCheckIcon />; | ||
| case "password": | ||
| return <FingerprintIcon />; | ||
| case "switch": | ||
| return <RepeatIcon />; | ||
| default: | ||
| return <KeyIcon />; | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicated
|
||
|
|
||
| interface ExternalActionWaitingProps { | ||
| message?: string | null; | ||
| mfaOptions?: MFAOption[]; | ||
| onMFASelect?: (mfaType: MFAType) => void; | ||
| isLoading?: boolean; | ||
| } | ||
|
|
||
| export function ExternalActionWaiting({ message }: ExternalActionWaitingProps) { | ||
| export function ExternalActionWaiting({ | ||
| message, | ||
| mfaOptions = [], | ||
| onMFASelect, | ||
| isLoading, | ||
| }: ExternalActionWaitingProps) { | ||
| const slot = useSlot(); | ||
| const l = useLocalization(); | ||
| const hasMfaOptions = mfaOptions.length > 0 && onMFASelect; | ||
|
|
||
| return ( | ||
| <div className="kma-step kma-step--center kma-external-action"> | ||
| <div className="kma-step__icon-wrap"> | ||
|
|
@@ -45,6 +86,33 @@ export function ExternalActionWaiting({ message }: ExternalActionWaitingProps) { | |
| </div> | ||
|
|
||
| <p className="kma-loading-hint">{l.externalActionWaiting}</p> | ||
|
|
||
| {hasMfaOptions && ( | ||
| <div className="kma-external-action__alternatives"> | ||
| {mfaOptions.map((option, idx) => ( | ||
| <Button | ||
| key={idx} | ||
| variant="secondary" | ||
| slotKey="mfaOption" | ||
| className="kma-option" | ||
| onClick={() => onMFASelect(option.type)} | ||
| disabled={isLoading} | ||
| > | ||
| <span | ||
| {...slot("mfaOptionIcon", "kma-option__icon")} | ||
| aria-hidden="true" | ||
| > | ||
| {getMFAIcon(option.type)} | ||
| </span> | ||
| <div className="kma-option__text"> | ||
| <div {...slot("mfaOptionLabel", "kma-option__label")}> | ||
| {option.label || l.mfaTypeLabels[option.type] || option.type} | ||
| </div> | ||
| </div> | ||
| </Button> | ||
| ))} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MFA options missing "switch-last" sort from UnifiedAuthFormLow Severity
Reviewed by Cursor Bugbot for commit f38988a. Configure here. |
||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||


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.
MFA submit error recovery navigates to wrong screen
Medium Severity
When
submitMFAis called from theExternalActionWaitingscreen and the API call fails, thesubmithelper's catch block unconditionally falls back to"awaiting_input"UI state. This causes users on the external-action-waiting screen to be unexpectedly redirected to the input form (which may have no relevant fields) instead of returning to the external action screen. Polling will eventually correct the state, but there's a visible flash of the wrong screen.Reviewed by Cursor Bugbot for commit f38988a. Configure here.