Sign-in: resend cooldown locks out a corrected email address #20
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
What happened
On the sign-in email step (
SignIn.tsx, SD-0001 §5.2), the operator typed the wrongemail address and submitted. The 60s resend cooldown then disabled the primary button
("Resend in 31s") even after correcting the address in the field, locking them out
of sending a code to the right address for the remainder of the window.
Diagnosis
accounts/service.py::request_codeenforces the cooldownper email address (
WHERE email = %s, INV-3 → PUC-2c). A request for a differentaddress would succeed immediately.
frontend/src/screens/SignIn.tsxkeeps one screen-leveluseCooldowncounter with no memory of which address it was set for, and the email-stepbutton is
disabled={cooldown > 0}unconditionally. The UI invents a guard the serverdoesn't have.
Fix
Key the client cooldown to the address it was set for (e.g. track
cooldownEmailalongside the timer). On the email step, disable the button + show "Resend in Ns" only
when the current input normalizes to the cooled-down address; any other address shows an
enabled "Send code". The code-step resend keeps the countdown (it always targets the
sent-to address). Server
retry_after_sremains the source of truth on 429.Source
frontend/src/screens/SignIn.tsx—useCooldown,sendCode, email-stepPrimaryButtonbackend/app/domains/accounts/service.py::request_code(per-address cooldown, for contrast)