fix(auth): stop offering account creation when registration is disabled - #6484
fix(auth): stop offering account creation when registration is disabled#6484waleedlatif1 wants to merge 1 commit into
Conversation
DISABLE_REGISTRATION blocks /signup server-side, but the invite flow, the login form, the SSO form, and the CLI handoff all kept routing people there, stranding invited users on a dead end. The flag also never covered OAuth account creation, so social sign-in still minted accounts for unknown identities.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryHigh Risk Overview Auth backend: Auth surfaces: Login and SSO hide the signup cross-link; Shared redirect logic: Docs: English self-hosting docs clarify that Reviewed by Cursor Bugbot for commit 23bec77. Configure here. |
Greptile SummaryThe PR consistently applies
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/auth/constants.ts | Adds a centralized social-provider registration gate that preserves provider configuration while disabling both supported new-account entrances. |
| apps/sim/lib/auth/auth.ts | Applies the registration gate to all configured first-party social providers while deliberately leaving allowlisted SSO behavior unchanged. |
| apps/sim/app/(auth)/auth-redirect.ts | Centralizes redirect precedence, invitation inference, and auth cross-link generation without introducing a distinct redirect outcome. |
| apps/sim/app/(auth)/signup/page.tsx | Replaces the bare disabled-registration response with an auth-shell flow that validates and preserves the callback to login. |
| apps/sim/app/invite/[id]/invite.tsx | Derives signed-out invitation actions from the registration flag and preserves invitation callbacks through shared link generation. |
| apps/sim/app/cli/auth/page.tsx | Routes signed-out CLI pairing through login when account creation is unavailable while retaining the pairing callback. |
| apps/sim/ee/sso/components/sso-form.tsx | Removes the dead signup cross-link under disabled registration without changing the configured SSO sign-in path. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Visitor[Signed-out visitor] --> Flag{DISABLE_REGISTRATION}
Flag -->|false| Signup[Signup page]
Flag -->|true| Login[Login path]
Signup --> ExistingOrNew[Existing or new account flow]
Login --> Existing[Existing accounts only]
Social[Social OAuth] --> SocialGate{Registration disabled?}
SocialGate -->|No| SocialAccount[Sign in or create account]
SocialGate -->|Yes, known identity| Existing
SocialGate -->|Yes, unknown identity| Blocked[Blocked-signup explanation]
Invite[Invitation or CLI callback] --> Flag
Login --> Callback[Return to validated callback]
Reviews (2): Last reviewed commit: "fix(auth): stop offering account creatio..." | Re-trigger Greptile
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 23bec77. Configure here.
Summary
Fixes #6473.
DISABLE_REGISTRATIONblocks/signupserver-side, but every surface kept routing people there — an invited user clicked "Create an account" and landed on an unstyled dead end. The flag also never covered OAuth account creation./cli/auth) bounced every signed-out visitor to/signup, so CLI login was broken for existing users on a registration-disabled instance — now goes to/login/signuprenders a proper auth-shell page that carries the callback over to login, instead of a bare<div>applyRegistrationGatestampsdisableSignUp+disableIdTokenSignInon every social provider — both are needed, since Better Auth's redirect callback readsprovider.options.disableSignUpwhile the id-token branch of/sign-in/socialreads a top-levelprovider.disableSignUpit never hoists from config/oauth-errorexplains a blocked signup instead of "please try again", which could never succeedresolveAuthRedirectso the signup form and the disabled page can't drift on which redirect param winsBreaking changes
Only when
DISABLE_REGISTRATION=true; no behavior change otherwise (the gate returns the provider map by reference when off):/loginrather than/signupSSO is deliberately exempt: it runs on
/sign-in/ssoagainst admin-configured, domain-verified providers, which is its own allowlist.Type of Change
Testing
bun run type-check,bun run lint:check,check:api-validation, andcheck:client-boundaryall clean. Full suite green (1144 files / 15479 tests). New tests: 5 for the registration gate, 2 for the CLI redirect, 5 forresolveAuthRedirect/buildAuthCrossLink, 3 for the invite branch, 2 for the SSO cross-link — each verified to fail when the fix is reverted. Not exercised against a live registration-disabled deployment.Not covered
/signupCTAs on landing pages — self-hosted prod redirects/→/login, so they're unreachable where the flag matters, and they now terminate on the explanatory pageChecklist