Skip to content

Explain and avoid the verification email resend limit - #2385

Merged
Mephistic merged 1 commit into
codeforboston:mainfrom
mvictor55:fix/verification-email-resend
Nov 21, 2026
Merged

Mephistic merged 1 commit into
codeforboston:mainfrom
mvictor55:fix/verification-email-resend

Conversation

@mvictor55

Copy link
Copy Markdown
Collaborator

Summary

After sign-up, MAPLE sends a verification email. If a reader clicks "Send Another Link" within about a minute of the last email, Firebase rejects the request (400 TOO_MANY_ATTEMPTS_TRY_LATER from accounts:sendOobCode, which the SDK throws as auth/too-many-requests). That code had no entry in errorMessages, so the reader saw "Something went wrong!". Reproduced on production on Nov 20 with a new email/password account: blocked 21 seconds after a send, accepted again 73 seconds after it.

No issue filed; found while debugging a user report.

This PR:

  • Explains the block. Adds auth/too-many-requests to errorMessages ("Too many attempts. Please wait a few minutes and try again."), and lets a single hook override the shared wording for a code. The resend hook says "A verification email was sent to you very recently. Check your inbox and spam folder, or try again in a minute." The shared wording stays general because sign-in throws the same code after repeated wrong passwords.
  • Avoids it. Records when a verification email goes out, including the one at sign-up, in localStorage keyed by user ID (with an in-page fallback when storage is unavailable). Both verify sections (the live VerifyAccountSectionLegacy and the flagged VerifyAccountSection) hide the resend button for that minute and show the existing "Check your email!" message instead. A reload no longer brings the button straight back. After the minute the button returns; before, it stayed hidden after a send until the page was reloaded.

Checklist

  • On the frontend, I've made my strings translate-able. Not done: the two new messages follow the existing English-only errorMessages map in components/auth/hooks.ts. No other new text.
  • If I've added shared components, I've added a storybook story. (No new components; the existing VerifyAccountSection story is unaffected.)
  • I've made pages responsive and look good on mobile. (No layout change.)
  • If I've added new Firestore queries, I've added any new required indexes to firestore.indexes.json (None.)

Checks run: yarn check-types, yarn test:website (45 suites pass, including the new components/auth/verificationEmailCooldown.test.ts), eslint on the changed files, yarn check-formatting. yarn test (Cloud Functions) not run; no backend changes.

Screenshots

None. The visible changes are the button staying hidden, with the existing "Check your email!" message, for a minute after a send, and the new error text.

Known issues

  • The one-minute window is measured, not documented. If Firebase's real window is longer, a click just after the minute shows the new message rather than "Something went wrong!".
  • Not checked in a browser yet. Please use the Vercel preview (steps below).
  • Open question, not addressed here. When Firebase rejects the continue URL (UNAUTHORIZED_DOMAIN, as happened on production from the Nov 13 release until www.mapletestimony.org was added to authorized domains on Nov 20), sendVerification retries immediately without one. If the rejected request counts toward the same per-minute limit, the retry fails with auth/too-many-requests and no email goes out. That may be why the fallback didn't rescue those sign-ups. If confirmed, a follow-up should pass url: location.href only on authorized origins rather than rely on the retry. A preview deploy is a good place to check, since its domain isn't authorized (see step 6).

Extra Deploy Steps

None.

Steps to test/reproduce

  1. On the Vercel preview, sign up with a new email/password account.
  2. Go to your profile within a minute of signing up. "Check your email!" shows, with no "Send Another Link" button.
  3. Wait for the minute to pass. The button appears without a reload.
  4. Click it. "Check your email!" shows and the button hides for another minute. Reloading the page doesn't bring it back early.
  5. To see the new message: sign in to the same account in a private window (separate storage) and click "Send Another Link" within a minute of the last email. Expect "A verification email was sent to you very recently…" instead of "Something went wrong!".
  6. For the open question above: if step 1 on the preview shows "Too many attempts. Please wait a few minutes and try again." at sign-up, or no verification email arrives, the continue-URL fallback is being blocked by the same limit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D33UhQgSR1T7cdPD4z3TYD

Firebase sends one verification email a minute to an account. Asking
again sooner fails with auth/too-many-requests, which had no message of
its own, so readers saw "Something went wrong!".

- Give auth/too-many-requests a message, with wording specific to the
  resend button that tells the reader an email was just sent.
- Record each verification email sent, including the one at sign-up,
  and hide the resend button on both verify sections until the minute
  is up, so a reload doesn't bring it straight back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D33UhQgSR1T7cdPD4z3TYD
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
maple-dev Ready Ready Preview Nov 20, 2026 11:00pm UTC

Request Review

@Mephistic
Mephistic merged commit 16a2c6f into codeforboston:main Nov 21, 2026
8 of 9 checks passed

This branch was successfully deployed

1 active deployment
Preview – maple-dev — 5085d8b0 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants