diff --git a/frontend/src/buttons/LaunchButton/LaunchButton.tsx b/frontend/src/buttons/LaunchButton/LaunchButton.tsx index ebfcaa370..2a38278ff 100644 --- a/frontend/src/buttons/LaunchButton/LaunchButton.tsx +++ b/frontend/src/buttons/LaunchButton/LaunchButton.tsx @@ -37,13 +37,14 @@ export const LaunchButton: React.FC = ({ }) => { const dispatch = useDispatch() const [prompt, setPrompt] = useState(false) - const ready = connection?.connectLink || (connection?.ready && connection?.connected) + const ready = connection?.connectLink || connection?.ready + const connected = connection?.connectLink || connection?.connected const loading = !ready || connection?.starting || (app?.service && !app.service.loaded) const disabled = launchDisabled(connection) || loading const autoLaunch = useSelector((state: State) => state.ui.autoLaunch === connection?.id && connection?.autoLaunch) useEffect(() => { - if (autoLaunch && !launchDisabled(connection) && ready) { + if (autoLaunch && !launchDisabled(connection) && connected) { dispatch.ui.set({ autoLaunch: undefined }) clickHandler() } diff --git a/frontend/src/cognito/components/MFACode/MFACode.tsx b/frontend/src/cognito/components/MFACode/MFACode.tsx index 0c4511d00..19e6cdb0c 100644 --- a/frontend/src/cognito/components/MFACode/MFACode.tsx +++ b/frontend/src/cognito/components/MFACode/MFACode.tsx @@ -22,6 +22,11 @@ export type MFACodeProps = { cognitoUser?: CognitoUser } +function formatMaskedDestination(destination?: string): string { + const lastFour = destination?.match(/\d{4}$/)?.[0] + return lastFour ? ` (ending in ${lastFour})` : '' +} + export function MFACode({ challengeName, onConfirmSignIn, @@ -106,7 +111,13 @@ export function MFACode({ )} - {challengeName === 'SMS_MFA' && {t('pages.auth-mfa.mfa-verification-sent')}} + {challengeName === 'SMS_MFA' && ( + + {t('pages.auth-mfa.mfa-verification-sent', { + number: formatMaskedDestination(localCognitoUser.challengeParam?.CODE_DELIVERY_DESTINATION), + })} + + )} {challengeName === 'SOFTWARE_TOKEN_MFA' && ( {t('pages.auth-mfa.totp-mfa-verification')} )} diff --git a/frontend/src/cognito/locales/en/translations.json b/frontend/src/cognito/locales/en/translations.json index 497920932..e9ab32219 100644 --- a/frontend/src/cognito/locales/en/translations.json +++ b/frontend/src/cognito/locales/en/translations.json @@ -48,7 +48,7 @@ "EMAIL_CODE_INVALID": "Invalid Email Code" }, "having-problems": "Having Problems?", - "mfa-verification-sent": "A verification code has been sent to your mobile device. {{number}} This code is only valid for 3 minutes.", + "mfa-verification-sent": "A verification code has been sent to your mobile device{{number}}. This code is only valid for 3 minutes.", "no-device-access": "Can't access your two-factor device", "title": "SMS Two-Factor Authentication", "totp-mfa-verification": "Enter the one-time password generated by your authentication app.", diff --git a/frontend/src/cognito/types.d.ts b/frontend/src/cognito/types.d.ts index db4bb01de..a74d1fbf1 100644 --- a/frontend/src/cognito/types.d.ts +++ b/frontend/src/cognito/types.d.ts @@ -11,6 +11,7 @@ export interface CognitoUser /*extends CognitoCognitoUser*/ { challengeName?: ChallengeOption challengeParam?: { challengeType: RecoveryChallengeType + CODE_DELIVERY_DESTINATION?: string } preferredMFA: MFAMethod username: string