You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(auth-service): hide Resend on OTP screen when sign-in cannot recover
Previously the OTP screen always offered "Resend code", even when the
upstream PAR row had silently lapsed (suspended tab, mobile background,
heartbeat throttling). The user could click Resend, receive a fresh
email, type the new code, and only then see "Sign in failed" — wasting
their time on a code that could not have worked.
The screen now never surfaces actions that cannot complete the flow:
- Track lastSuccessfulHeartbeatAt; treat the PAR as dead once we cross
upstream's 5 min AUTHORIZATION_INACTIVITY_TIMEOUT without a fresh ok
ping (the upstream death point is exact — no margin needed).
- Hide #btn-resend and surface a #btn-start-over (→ /auth/abort) the
moment parLikelyDead() flips. Reconciled on every heartbeat tick
(including transient ticks, so a stale-by-time case still hides the
button) and on the visibilitychange event (so a backgrounded tab
returning to focus reflects reality immediately).
- Inline "Send a new code" action on the OTP-expired error now branches:
parLikelyDead() → "Start over"; otherwise existing "Send a new code".
This is the proactive UI complement to the existing reactive abort gate.
Server-side enforcement of the same invariant on /email-otp/send-
verification-otp and /sign-in/email-otp is a separate follow-up.
Test: new @resend-hidden-when-par-dead scenario; full
@otp-and-par-expiry / @par-heartbeat / @resend-after-par-dead /
@otp-expiry suite still passes (7 scenarios, 78 steps).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign-in no longer offers "Resend code" when the new code wouldn't have worked anyway.
6
+
7
+
**Affects:** End users
8
+
9
+
**End users:** Previously, if you sat on the email-code step long enough that the underlying sign-in had silently timed out (most often: leaving the tab in the background while reading email on your phone, or coming back after an interruption), the page would still show **Resend code**. Clicking it sent you a fresh email, but the moment you typed the new code you'd see "Sign in failed" — the code was issued for a sign-in that could no longer complete, so it never had a chance.
10
+
11
+
The page now hides the Resend button as soon as it knows the sign-in can't be recovered, and shows **Start over** in its place. Clicking Start over takes you back to the app you came from to begin again, instead of letting you waste time on a code that couldn't work.
12
+
13
+
If you're actively using the page (the tab in the foreground), nothing changes: Resend stays available and works the same way it always has.
0 commit comments