feat(mfa): create new ModalMfaProtected component#19362
Conversation
4be0a3f to
e5ed905
Compare
| modal-mfa-protected-title = Enter confirmation code | ||
| modal-mfa-protected-subtitle = to change your { -product-mozilla-account } info |
There was a problem hiding this comment.
These two strings need to either be a single string (similar to confirm-signup-code-heading-2) or we should adjust the strings to make sure the title and subtitle stand alone (e.g. something like Enter confirmation code Enter code to change your { -product-mozilla-account } info).
While we've been doing the former, I think we should consider avoiding this design going forward.
- Some languages end up inverting the two sections with the span element coming first (following their language word order) so you don't have consistency across languages.
- This structure no longer works for strings in the CMS since they can't be combined (and thus become very difficult to translate naturally), so we've had to adjust those already.
There was a problem hiding this comment.
Hi @bcolsson! I have updated the strings, now both the main title and subtitle stand alone. Our content designer Jeff wonder if it's necessary to update existing designs to avoid splitting sentences as well.
There was a problem hiding this comment.
@MagentaManifold - Missed this question: I wouldn't call it a high priority for the strings currently localized but I'd consider updating them at some point since we're already changing them elsewhere (such as in the CMS strings).
|
The Figma design does not include error states, and my current assumptions on error messages are:
It might also make sense to close the modal and show an alert bar when encountering a server error, and the success banner can also be an alert bar, so I want the reviewer's opinion on this! |
| const onClick = useCallback( | ||
| (ev: React.MouseEvent) => { | ||
| ev.preventDefault(); | ||
| ev.stopPropagation(); |
There was a problem hiding this comment.
Did you mean to change this? If so let's put in a a separate 'polish' PR.
There was a problem hiding this comment.
Yeah because preventDefault doesn't actually work. stopPropagation is a hack (used in our actual code as well) needed to prevent the modal from disappearing due to losing focus. And yeah I can put it in a separate PR
There was a problem hiding this comment.
Thanks for fixing this. That makes sense.
| > | ||
| <p id="modal-mfa-protected-desc" className="my-6"> | ||
| Enter the code that was sent to{' '} | ||
| <span className="font-bold">{email}</span> within 5 minutes. This |
There was a problem hiding this comment.
We should make this configurable. Please file a follow up for this since it involves messing with the app's configuration. For this PR however, pass the time limit as a prop.
There was a problem hiding this comment.
Yeah I should have thought about it, cuz I literally just worked that email template
|
|
||
| await userEvent.click(screen.getByTestId('modal-dismiss')); | ||
|
|
||
| expect(onDismiss).toHaveBeenCalled(); |
There was a problem hiding this comment.
Nothing to do here, but just a call out. I think the component that invokes this model should display a banner alerting the user that in order to proceed they must provide verification. Again, maybe ping UX on what message to display on dismissal if unsure.
dschom
left a comment
There was a problem hiding this comment.
Thanks for the updates! R+WC
- Make the time frame a prop and address the l10n feedback.
- Address the l10n feedback
|
@dschom Thanks for the review! By "success banner" I mean for successfully resending the code, not for successful verification (I agree that we don't need a success message for verification since continuing is enough). I am using a ready-made resend success banner component ( |
27a50ce to
dfc9720
Compare
| modal-mfa-protected-instruction = | ||
| Enter the code that was sent to <email>{ $email }</email> within { $expirationTime -> | ||
| [one] 1 minute | ||
| *[other] { $expirationTime } minutes | ||
| }. |
There was a problem hiding this comment.
| modal-mfa-protected-instruction = | |
| Enter the code that was sent to <email>{ $email }</email> within { $expirationTime -> | |
| [one] 1 minute | |
| *[other] { $expirationTime } minutes | |
| }. | |
| modal-mfa-protected-instruction = | |
| { $expirationTime -> | |
| [one] Enter the code that was sent to <email>{ $email }</email> within { $expirationTime } minute. | |
| *[other] Enter the code that was sent to <email>{ $email }</email> within { $expirationTime } minutes. | |
| } |
While technically valid syntax, it's best practice to have the whole string for each variant of the selector. (This is better supported by Pontoon and easier to localize.)
dfc9720 to
8fab2a9
Compare
| # email (String) - the user's email | ||
| # expirationTime (Number) - the expiration time in minutes | ||
| modal-mfa-protected-instruction = { $expirationTime -> | ||
| [one] Enter the code that was sent to <email>{ $email }</email> within 1 minute. |
There was a problem hiding this comment.
| [one] Enter the code that was sent to <email>{ $email }</email> within 1 minute. | |
| [one] Enter the code that was sent to <email>{ $email }</email> within { $expirationTime } minute. |
Minor nit. Feel free to merge after fixing.
Because: * we need a modal for MFA confirmation code input for `MfaProtectedActionGuard` This commit: * creates a new ModalMfaProtected, with stories and unit tests. Closes #FXA-12302
8fab2a9 to
2961ab2
Compare

Closes #
Because
MfaProtectedActionGuardThis pull request
ModalMfaProtectedcomponent, with stories and unit tests.Issue that this pull request solves
Closes: FXA-12302
Checklist
Put an
xin the boxes that applyScreenshots (Optional)
Other information (Optional)
Any other information that is important to this pull request.