Repository navigation
fix: show why resending the two-factor email code failed - #44055
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: 9a2a1b9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. WalkthroughThe email two-factor modal now displays a formatted server-provided reason when a resend fails for a reason other than an expired or missing challenge. The REST rate-limit message no longer begins with “Error,”. A test covers a rate-limited response. ChangesTwo-factor resend errors
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Low Possibly related PRs
Suggested labels: Suggested reviewers: Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #44055 +/- ##
===========================================
+ Coverage 74.96% 75.11% +0.14%
===========================================
Files 5784 5805 +21
Lines 268218 268846 +628
Branches 51821 52285 +464
===========================================
+ Hits 201080 201937 +857
+ Misses 62345 62084 -261
- Partials 4793 4825 +32
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Test Results SummaryThis comment shows the latest test results for this pull request.
ℹ️ About Flakiness.io in GitHubYour team has set up Flakiness.io pull request comments. This comment is updated when
Flakiness.io rewrites the comment in place, so it always reflects the most recently tested commit. |
|
@cubic-dev-ai review |
@ricardogarim I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/meteor/client/components/TwoFactorModal/TwoFactorEmailModal.tsx">
<violation number="1" location="apps/meteor/client/components/TwoFactorModal/TwoFactorEmailModal.tsx:66">
P2: This catch handler can throw instead of showing any toast when the request rejects with an unrecognized error shape. Pass a translated fallback to `getErrorMessage`, so unexpected resend failures still produce the `error-email-send-failed` toast.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
cc35626 to
7c28fce
Compare
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
0748583 to
9a2a1b9
Compare
9a2a1b9 to
dcf007f
Compare
Aryan9891
left a comment
There was a problem hiding this comment.
Clean fix in apps/meteor/client/components/TwoFactorModal/TwoFactorEmailModal.tsx and apps/meteor/server/api/ApiClass.ts!
- Error extraction: Wrapping
errorwithgetErrorMessage(error, 'Something_went_wrong')prevents[object Object]interpolation int('error-email-send-failed', { message })when the server returns a structured error payload. - Rate-limit copy & tests: Removing the redundant
"Error, "prefix inApiClass.tsavoids"Error trying to send email: Error, too many requests...", andTwoFactorEmailModal.spec.tsxpins the rate-limited toast behavior cleanly.
Proposed changes (including videos or screenshots)
When the server refuses "Resend email" on the email two-factor screen, the toast shows
Error trying to send email: [object Object]. A user sees this after 5 resends in one minute (HTTP 429).The modal put the error object into the
{{message}}value oferror-email-send-failed. Now it puts the text fromgetErrorMessage(error)there. The toast keeps the translated prefix and shows the reason from the server:The REST rate limit message started with "Error,", so the toast showed "Error" two times. The message in
ApiClass.tsnow starts with "Too many requests.". Every endpoint uses this message. The[error-too-many-requests]suffix does not change, soRegisterFormstill finds the error.Root cause
Error, and the value became readable text.[object Object].Decisions and gaps
error-email-send-failedprefix, because it is the only translated part of the toast. The other option was to give the error to the toast directly, as other screens do. That removes the prefix, so the full toast is in English.error-too-many-requestsi18n key still starts with "Error,". No client code shows it for REST errors, so this PR does not change the key and its 54 translations.TEST_MODE. A local server returned the new text on the sixth call in one minute.Issue(s)
Steps to test or reproduce
[object Object].Further comments
Summary by CodeRabbit