#FE: Auth screens (from backend Phase 2)
Frontend spec for every feature of backend Phase 2: Authentication & Security (requirements complete 2026-10-01, not built). V8 requirement Backend endpoint paths are not defined yet, so each screen names the capability it needs. When the backend publishes paths, they're added here (auto-sync). Field rules come from the backend doc. Where the doc doesn't say, the V7 behaviour is used and marked V7 only, or the item is marked Assumption.
i18n namespaces: auth.register.*, auth.verify.*, auth.login.*, auth.oauth.*, auth.forgot.*, auth.reset.*, auth.invite.*, auth.twoFactor.*, auth.ipApproval.*, auth.errors.*. All 8 locales.
#2.1 Register
Route: /register (query: invite, ref, aff) · Public
| Field | Rule | Source |
|---|---|---|
| Name | required, max 150 | V8 requirement required · max V7 only |
| required, valid email | V8 requirement | |
| Password | required, min 8 (max 64 as V7 login) | V8 requirement min · V7 only max |
| Turnstile | widget token, required | V8 requirement |
| Referral / affiliate / invitation code | optional. Pre-filled from the query string, read-only when pre-filled | V8 requirement Both code types are now specified — backend Phase 18 (2026-10-08). A Tolt affiliate code (18.1) and a referral code (18.5) both arrive in the link and neither is typed, which confirms the pre-filled read-only treatment. One thing to carry through: 18.1 says the affiliate code is saved for the Google and GitHub routes too, so the code must survive the round trip to the provider and back. The referral code also pays immediately — the new user's credit is on their balance at sign-up (18.6). What a user holding both codes gets is still unsettled (D-54) |
| Removed from sign-up — backend 2.1, 2026-10-09 (Vishal) V8 requirement. Nothing to design on this screen. ⚠️ But a correction to what this row said earlier today: it claimed the whole conflict was closed. It is not — Bhavik's rule bans the "About you" questions everywhere, including Account information, and 3.2 still carries them as free-text profile fields (added 2026-10-09). So the conflict closed for sign-up only; see the callout on FE: Account screens. V7 had company size, industry, management experience, heard about us. ~~V8 requirement optional · question list Open question (step 2 or the same form?) |
States: idle · submitting (button spinner) · 422 field errors · 429 · success → the user is already signed in (see below). Turnstile expiry → re-render the widget.
#2.2 Email verification
Routes: /verify-email (check inbox) · /verify-email/{id}/{hash} (result — corrected 2026-10-09 from /verify/:token) · Public
- Check-inbox: shows the address, "Resend" with a 60 s cooldown Assumption (backend rate-limits resends, 2.11), and "Wrong email? Register again".
- Result: success → "Email verified" + Log in button · expired (> 24 h) → "Link expired" + resend · invalid/used → neutral message + log in.
#2.3 Login
Route: /login?next= · Public (logged-in users → dashboard)
| Result from backend | Screen behaviour |
|---|---|
| Wrong email or password | One generic message auth.login.invalid |
| Unverified | Login succeeds — changed 2026-10-09. Not an error any more: the user goes in, and email_verified: false raises the reminder banner with Resend. The old auth.login.unverified refusal is gone |
| Banned | auth.login.banned. No retry |
| 2FA required | → 2.7 step (no token yet) |
| IP not whitelisted | → 2.8 notice |
| Success | Token (BFF cookies) + user + organizations → organization chosen (last used / main / first; none → create organization) → next or dashboard |
| 429 | Countdown from Retry-After |
Update 2026-10-15 (Pair 1): at organization level only ownership transfer still needs a verified email. Sending/resending invitations and in-app Accept/Decline of invitations now work while unverified (security concern raised as D-58). Creating a server and promo credits still need a verified email.
Fields: email, password (show/hide toggle). Links: forgot password, register, Google, GitHub. Login history is recorded by the backend. Nothing to do on the frontend.
#2.4 Google / GitHub login
Routes: buttons on login/register · callback landing /auth/social/{provider}/callback (corrected 2026-10-09 from /oauth/:provider/callback) · Public
- New email → account created. Existing email → linked automatically. V8 requirement
- Errors come back to
/login?error=<code>: provider disabled, cancelled, email missing, state invalid → translated message. Codes to be agreed Missing. - Buttons show only for providers the backend reports as enabled (keys are managed in the admin panel) → needs a public config endpoint Missing (see Runtime configuration).
Three rules added by the backend on 2026-10-09 (2.4, Vishal):
| Rule | What it means on screen |
|---|---|
| A new Google / GitHub user is marked verified at once — no activation email (unlike V7) | So the social path never touches the verification screens. It goes provider → callback → straight in: no check-inbox step, no "please verify your email" banner, ever. Worth stating because the email path and the social path now end in different account states, and a shared "after sign-up" screen would be wrong for one of them |
| An unverified account becomes verified on social login | So signing in with Google clears the unverified banner. A user who registered by email, never verified, and later uses Google on the same address is simply verified afterwards — the banner must be gone on the next render, not cached from the session that started unverified |
| Linking or creating needs a provider-verified email | A new failure state, and its message is not written Open question. If Google or GitHub hands back an address it has not verified, the login cannot proceed. It belongs in the /login?error=<code> list alongside provider disabled and email missing — and the message has to be actionable, because a generic "sign-in failed" leaves the user with nothing to do. The useful version names the cause and the fix: the address is not verified with the provider, so verify it there and try again. Nothing is invented here — the code and wording are still the backend's to give |
#2.5 Forgot / reset password
Routes: /forgot-password · /reset-password (corrected 2026-10-09 — no path parameter; the token arrives in the query string) · Public
- Forgot: email field → always "If an account exists, we sent a link" (no enumeration) Assumption.
- Reset: new password + confirm (min 8). Link valid 60 min. Success → "Password changed. All devices were signed out" → login. Expired → back to forgot.
Two rules added by the backend on 2026-10-09 (2.5, Vishal):
| Rule | What it means on screen |
|---|---|
| A successful reset also marks the email as verified | So a reset can get a user out of the unverified state — which is more useful than it sounds, because it is a second route to verification for someone whose verification email never arrived. Two consequences: the success message should send them to login as before, but after that login there must be no "please verify your email" banner; and nothing should advertise reset-as-verification, because telling people to reset their password to verify an address is poor advice. Just make sure the banner is gone |
| A banned account cannot reset — no email is sent, and an older link is refused | Two screens, and the message is unstated for both Open question. On /forgot-password nothing is sent, so the generic "if an account exists, we sent a link" leaves a banned user waiting for an email that will never come. On /reset-password/:token a link that was already valid now fails, so it needs an error that is not "expired" — the link is refused, not timed out. There is a real decision here, not just copy: login already shows a separate banned message (2.3), so the product does disclose banned state once the password is right — but the forgot form has no password to check, so saying "banned" there would reveal account state to anyone who types an email. This spec keeps the generic message on the forgot form and uses a distinct "this link can no longer be used" on the reset screen, which leaks nothing; if the backend wants the banned message shown instead, that is its call to make |
#2.6 Invitation password
Route: /invitations/:token · Public
✅ Built 2026-10-09 (Pair 1), together with 4.3 Invite members. V8 requirement
- Shows the organization name + inviter (if the backend returns them Missing), a "set your password" form (+ name if unknown), then login → the invited organization becomes the current one.
- Invalid/expired token → "This invitation is no longer valid". Links last 7 days.
- An existing user who opens the link → log in → accept (still required, and that is the backend's own rule).
#2.7 2FA at login
Step inside /login (not a separate URL, so the pending login state isn't bookmarkable).
| Method | UI |
|---|---|
| Email code | 6-digit input Assumption length, valid 10 min, resend (cooldown), "N tries left" (max 5 wrong) |
| Google Authenticator | 6-digit TOTP input |
| Backup code | text input |
After 5 wrong tries → message + back to login. The token is only stored after 2FA passes.
#2.8 IP whitelist at login
- Login from an unknown IP → screen "We emailed you a link to approve this IP (valid 24 h). Approve it, then log in again."
- Approval link route
/approve-ip(corrected 2026-10-09 from/ip-approval/:key— different name, and no path parameter) → approved / expired / invalid result + Log in.
Three rules added by the backend on 2026-10-09 (2.8, Vishal). One of them confirms what this page already said:
| Rule | What it means on screen |
|---|---|
| After approving, the user logs in again | Already what this page specified — "approve it, then log in again" — so nothing changes. Worth keeping explicit, because the tempting design is to resume the half-finished login from the approval page, and that is not how it works: approval allows the IP, it does not complete the sign-in |
| A new approval email is sent at most once every 5 minutes per IP | So a resend button would lie. If the user does not get the email and tries logging in again inside five minutes, no new email is sent while the screen still says one was. Either offer no resend at all on this screen, or show a resend with a visible five-minute cooldown — never a button that appears to work and silently does nothing. The first time is simplest and honest: tell them to check their inbox and that a new link can be requested in five minutes |
| Exact IP matching, as V7 — no ranges. Ranges, "if ever", would only be manual entries on the account's IP whitelist page. And since 3.10 was built (2026-10-09) there is somewhere to watch this from: the account's IP whitelist list shows the blocked address as pending until the link is opened | This is the one with a real user cost, and the screen should be honest about it. An exact match means a dynamic home IP or a mobile connection gets blocked again every time the address changes, each time needing a fresh email and another login. There is no way to pre-approve a range at login. So the blocked screen should not imply this is a one-off — and the place to warn about it is where the feature is switched on, not here (see 3.10 on FE: Account screens) |
#2.9 Tokens & session
- Access 15 d / refresh 30 d — Sanctum Bearer tokens since 2026-10-08, with the refresh built by Central — stored per FE: Foundation D-1.
- Central issues the token and the refresh token itself, after all checks pass (password → 2FA → IP whitelist), for email and Google/GitHub login alike. The exact method is decided in the backend's Phase 2 plan. V8 requirement 2026-10-03 — for the frontend this means one login response carries both tokens, and the OAuth callback (2.4) is handled the same way as a password login.
- Refresh once on 401, then retry the original GET. Never replay a mutation automatically.
- Session expired →
/login?next=<path>+auth.errors.sessionExpired.
#2.10 Logout
User menu → Log out → BFF revokes the token (backend) → clear cookies + client stores → login. Link not prefetched.
#2.11 Rate limits
Every auth form handles 429 with the wait time and disables submit until then. Resend buttons keep their own cooldown.
#Runtime configuration
Settings managed in the backend admin panel affect the screens: Turnstile site key, which social providers are enabled. The frontend can't hard-code them in env files if admins change them at runtime. Needs a public config endpoint (e.g. turnstile_site_key, oauth_providers: ["google","github"], registration_open) Missing. Until then: Open question.
#Phase 2 items not on these screens
- Organizations: Conflict the frontend does the opposite of Phase 2. The backend doc says organizations are not auto-created, which would mean a "create your first organization" screen after the first login. Bhavik decided on 2026-10-05 09:46 that the backend creates a default organization at sign-up, so there is no such screen — the user lands straight in their organization and can create more later. A fallback screen is kept only for an account that somehow has none. See D-2 on Open questions and Organizations.
- Dropped V7 sign-up checks (throwaway email, Gmail dots, device fingerprint): no UI.
- Migration: existing V7 users log in with the same email/password and keep 2FA, IP whitelist and social logins. No special screen is needed Assumption.