Make self-service signup opt-in via SIGNUP_ENABLED

/users/signup answers 403 unless SIGNUP_ENABLED is set. A public
GET /utils/config/ tells the login page, which hides the sign-up link,
and the signup page explains that an administrator creates accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
2026-10-06 11:24:27 +02:00
co-authored by Claude Opus 5.5
parent 6e18ab96ce
commit de7ee759f9
12 changed files with 136 additions and 17 deletions
+9
View File
@@ -7,6 +7,7 @@ import {
type UserPublic,
type UserRegister,
UsersService,
UtilsService,
} from "@/client"
import { liveStore } from "@/components/Flow/liveStore"
import { isPortal } from "@/lib/portal"
@@ -32,6 +33,14 @@ export function safeRedirect(target: string | undefined): string {
return target
}
/** Whether this instance lets a visitor create an account; unknown while loading. */
export const useSignupEnabled = (): boolean | undefined =>
useQuery({
queryKey: ["config"],
queryFn: UtilsService.readConfig,
staleTime: Number.POSITIVE_INFINITY,
}).data?.signup_enabled
const useAuth = () => {
const navigate = useNavigate()
const queryClient = useQueryClient()