Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions frontend/src/buttons/LaunchButton/LaunchButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ export const LaunchButton: React.FC<Props> = ({
}) => {
const dispatch = useDispatch<Dispatch>()
const [prompt, setPrompt] = useState<boolean>(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()
}
Expand Down
13 changes: 12 additions & 1 deletion frontend/src/cognito/components/MFACode/MFACode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -106,7 +111,13 @@ export function MFACode({
</Notice>
)}
<Box my={4}>
{challengeName === 'SMS_MFA' && <Typography>{t('pages.auth-mfa.mfa-verification-sent')}</Typography>}
{challengeName === 'SMS_MFA' && (
<Typography>
{t('pages.auth-mfa.mfa-verification-sent', {
number: formatMaskedDestination(localCognitoUser.challengeParam?.CODE_DELIVERY_DESTINATION),
})}
</Typography>
)}
{challengeName === 'SOFTWARE_TOKEN_MFA' && (
<Typography>{t('pages.auth-mfa.totp-mfa-verification')}</Typography>
)}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/cognito/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/cognito/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface CognitoUser /*extends CognitoCognitoUser*/ {
challengeName?: ChallengeOption
challengeParam?: {
challengeType: RecoveryChallengeType
CODE_DELIVERY_DESTINATION?: string
}
preferredMFA: MFAMethod
username: string
Expand Down
Loading