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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user