fix(signin): key the resend cooldown to the address it was set for (#20) #22
Reference in New Issue
Block a user
Delete Branch "fix-20-signin-cooldown-keying"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #20.
The email-step Send button disabled on any running cooldown, so a merchant who mistyped their address was locked out of sending to the corrected one for the rest of the 60s window — a guard the server never had (
request_codeenforces the cooldown per address, SD-0001 INV-3 → PUC-2c).Change
frontend/src/cooldown.ts:cooldownAppliesTo(input, cooldownEmail, secondsLeft)— blocks only while the countdown runs AND the input normalizes (strip+lowercase, mirroringnormalize_email/INV-2) to the address the cooldown was set for. Unit-tested first (5 cases, incl. the lockout regression).SignIn.tsxtrackscooldownFor(set on successful send and on a 429resend_cooldown) and gates the email-step button through it. Same address still shows the honest "Resend in Ns"; any other address sends immediately. Code-step resend unchanged.package-lock.json: sync recorded version with package.json (0.4.0).Verification
tsc --noEmitclean, backend 68/68 (untouched).Sibling backlog capture: #21 (layered OTP send rate-limit hardening — not in this PR).