Skip to content

feat(TEA-69): disable signups after the first account exists#33

Merged
Mohamed-Elshesheny merged 2 commits intomainfrom
feat(auth)/Disable-signups-after-bootstrap
Apr 15, 2026
Merged

feat(TEA-69): disable signups after the first account exists#33
Mohamed-Elshesheny merged 2 commits intomainfrom
feat(auth)/Disable-signups-after-bootstrap

Conversation

@sherbiiny
Copy link
Copy Markdown
Contributor

Summary

Single-admin bootstrap for auth: signups are only allowed until the first user exists. The web app gates /signup, hides the signup link on login when closed, and reads availability from the backend via the SDK. VITE_BACKEND_URL is declared in turbo.json for caching and ESLint.

Related Issues

Fixes #TEA-69

Type of Change

New feature

Changes

  • Backend: signup availability at GET /api/auth-state/signup-availability (signupEnabled); auth rejects additional registrations once a user exists.
  • SDK: getSignupAvailability() uses the shared API client and returns { signupEnabled }.
  • Web: signupAvailabilityQueryOptions; /signup redirects in beforeLoad when disabled; login hides the signup link; invalidate availability after successful registration.
  • Turbo: globalEnv: ["VITE_BACKEND_URL"].

How to Test

  1. Fresh DB (no users): /signup shows the form; login shows the signup link.
  2. After the first account: /signup redirects to /login; signup link hidden; first user can still sign in.
  3. Confirm a second signup fails via the API and the UI stays locked.

Expected result: At most one self-serve signup; returning users can log in; no signup path in the UI when the system is locked.

Mohamed-Elshesheny and others added 2 commits April 15, 2026 16:02
…ter bootstrap

- Added a new SQL trigger to prevent user signup if a user already exists in the database.
- Introduced an `authStateRouter` with an endpoint to check if signup is enabled.
- Updated the authentication logic to throw an error when signup is attempted while disabled.
@Mohamed-Elshesheny Mohamed-Elshesheny merged commit bc0bfe9 into main Apr 15, 2026
1 check passed
@Mohamed-Elshesheny Mohamed-Elshesheny deleted the feat(auth)/Disable-signups-after-bootstrap branch April 15, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants