Skip to content

Commit 6083d72

Browse files
committed
fix(*): Add mfaTotpQrCodePrompt translation
1 parent 1972ebc commit 6083d72

File tree

8 files changed

+18
-4
lines changed

8 files changed

+18
-4
lines changed

packages/angular/src/lib/auth/forms/mfa/totp-multi-factor-enrollment-form.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ describe("<fui-totp-multi-factor-enrollment-form />", () => {
5555
verificationCode: "Verification Code",
5656
verifyCode: "Verify Code",
5757
},
58+
prompts: {
59+
mfaTotpQrCodePrompt: "Scan this QR code with your authenticator app",
60+
},
5861
errors: {
5962
unknownError: "An unknown error occurred",
6063
},
@@ -148,7 +151,7 @@ describe("<fui-totp-multi-factor-enrollment-form />", () => {
148151
fixture.detectChanges();
149152

150153
expect(screen.getByAltText("TOTP QR Code")).toBeInTheDocument();
151-
expect(screen.getByText("TODO: Scan this QR code with your authenticator app")).toBeInTheDocument();
154+
expect(screen.getByText("Scan this QR code with your authenticator app")).toBeInTheDocument();
152155
expect(screen.getByLabelText("Verification Code")).toBeInTheDocument();
153156
expect(screen.getByRole("button", { name: "Verify Code" })).toBeInTheDocument();
154157
});

packages/angular/src/lib/auth/forms/mfa/totp-multi-factor-enrollment-form.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class TotpMultiFactorSecretGenerationFormComponent {
134134
template: `
135135
<div class="fui-qr-code-container">
136136
<img [src]="qrCodeDataUrl()" alt="TOTP QR Code" />
137-
<p>TODO: Scan this QR code with your authenticator app</p>
137+
<p>{{ mfaTotpQrCodePrompt() }}</p>
138138
</div>
139139
<form (submit)="handleSubmit($event)" class="fui-form">
140140
<fieldset>
@@ -165,6 +165,7 @@ export class TotpMultiFactorVerificationFormComponent {
165165

166166
verificationCodeLabel = injectTranslation("labels", "verificationCode");
167167
verifyCodeLabel = injectTranslation("labels", "verifyCode");
168+
mfaTotpQrCodePrompt = injectTranslation("prompts", "mfaTotpQrCodePrompt");
168169
unknownErrorLabel = injectTranslation("errors", "unknownError");
169170

170171
form = injectForm({

packages/react/src/auth/forms/mfa/totp-multi-factor-enrollment-form.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ describe("<MultiFactorEnrollmentVerifyTotpForm />", () => {
169169
verificationCode: "verificationCode",
170170
verifyCode: "verifyCode",
171171
},
172+
prompts: {
173+
mfaTotpQrCodePrompt: "Scan this QR code with your authenticator app",
174+
},
172175
}),
173176
});
174177

@@ -192,6 +195,7 @@ describe("<MultiFactorEnrollmentVerifyTotpForm />", () => {
192195

193196
expect(container.querySelector(".fui-qr-code-container")).toBeInTheDocument();
194197
expect(container.querySelector("img[alt='TOTP QR Code']")).toBeInTheDocument();
198+
expect(screen.getByText("Scan this QR code with your authenticator app")).toBeInTheDocument();
195199
});
196200
});
197201

packages/react/src/auth/forms/mfa/totp-multi-factor-enrollment-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function MultiFactorEnrollmentVerifyTotpForm(props: MultiFactorEnrollment
155155
>
156156
<div className="fui-qr-code-container">
157157
<img src={qrCodeDataUrl} alt="TOTP QR Code" />
158-
<p>TODO: Scan this QR code with your authenticator app</p>
158+
<p>{getTranslation(ui, "prompts", "mfaTotpQrCodePrompt")}</p>
159159
</div>
160160
<form.AppForm>
161161
<fieldset>

packages/shadcn/src/components/totp-multi-factor-enrollment-form.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ describe("<TotpMultiFactorEnrollmentForm />", () => {
8787
verificationCode: "Verification Code",
8888
verifyCode: "Verify Code",
8989
},
90+
prompts: {
91+
mfaTotpQrCodePrompt: "Scan this QR code with your authenticator app",
92+
},
9093
}),
9194
});
9295

@@ -104,6 +107,7 @@ describe("<TotpMultiFactorEnrollmentForm />", () => {
104107
expect(screen.getByTestId("input-otp-slot-0")).toBeInTheDocument();
105108
});
106109

110+
expect(screen.getByText("Scan this QR code with your authenticator app")).toBeInTheDocument();
107111
expect(screen.getByRole("button", { name: "Verify Code" })).toBeInTheDocument();
108112
});
109113

packages/shadcn/src/components/totp-multi-factor-enrollment-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function MultiFactorEnrollmentVerifyTotpForm(props: MultiFactorEnrollment
108108
<div className="border rounded-lg p-4">
109109
<img src={qrCodeDataUrl} alt="TOTP QR Code" className="mx-auto" />
110110
<p className="text-sm text-muted-foreground text-center mt-2">
111-
Scan this QR code with your authenticator app
111+
{getTranslation(ui, "prompts", "mfaTotpQrCodePrompt")}
112112
</p>
113113
</div>
114114
</div>

packages/translations/src/locales/en-us.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,6 @@ export const enUS = {
9999
mfaEnrollmentPrompt: "Select a new multi-factor enrollment method",
100100
mfaAssertionPrompt: "Please complete the multi-factor authentication process",
101101
mfaAssertionFactorPrompt: "Please choose a multi-factor authentication method",
102+
mfaTotpQrCodePrompt: "Scan this QR code with your authenticator app",
102103
},
103104
} satisfies Translations;

packages/translations/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,6 @@ export type Translations = {
105105
mfaEnrollmentPrompt?: string;
106106
mfaAssertionPrompt?: string;
107107
mfaAssertionFactorPrompt?: string;
108+
mfaTotpQrCodePrompt?: string;
108109
};
109110
};

0 commit comments

Comments
 (0)