feat(accounts): locked registration, for staging
Pull request / title (pull_request) Successful in 1s
CI / test (pull_request) Successful in 1m28s
CI / image (apps/api/Dockerfile, t5de-hub-api) (pull_request) Skipped
CI / image (apps/web/Dockerfile, t5de-hub-web) (pull_request) Skipped

A third registration setting, locked: every new account waits for a
moderator's approval, Discord sign-ins too, and only approved accounts sign
in to T5DE's other sites. Today staging's closed registration still lets any
Discord account in as a basic account, straight into Music's staging (and
soon payments' staging, with PayPal's sandbox).

The gate is the OAuth provider's postLogin check: an unapproved account is
sent to the website's waiting page and no code is issued, on every authorize
request and /oauth2/continue. Open and closed behave as before, so prod's
Music sign-ins don't change.
This commit is contained in:
dhkatz committed 2026-11-20 12:29:19 -08:00
1 parent 02e8269d4d
commit 23cae691a9
11 files changed
+111 -22

No files matched your search

+7 -2
View File
@@ -69,9 +69,14 @@ export async function decideAccount(_: ActionState, form: FormData): Promise<Act
export async function setRegistration(_: ActionState, form: FormData): Promise<ActionState> {
return attempt(async () => {
const registration = field(form, "registration") === "closed" ? "closed" : "open";
const value = field(form, "registration");
const registration = value === "closed" || value === "locked" ? value : "open";
unwrap(await api.console.settings.put({ registration }));
revalidatePath("/console");
return registration === "closed" ? "Registration closed: new accounts wait for approval." : "Registration open.";
return registration === "locked"
? "Registration locked: every new account waits for approval, and only approved ones sign in to other sites."
: registration === "closed"
? "Registration closed: new accounts wait for approval."
: "Registration open.";
});
}
+6 -3
View File
@@ -71,9 +71,11 @@ export default async function Console() {
<CardHeader>
<CardTitle>Registration</CardTitle>
<CardDescription>
{settings.registration === "closed"
? "Closed: new accounts can sign in, but wait for a moderator's approval."
: "Open: new accounts can use the hub at once."}
{settings.registration === "locked"
? "Locked: every new account, Discord ones too, waits for a moderator's approval, and only approved accounts sign in to T5DE's other sites. For staging."
: settings.registration === "closed"
? "Closed: new accounts can sign in, but wait for a moderator's approval."
: "Open: new accounts can use the hub at once."}
</CardDescription>
</CardHeader>
<CardContent>
@@ -82,6 +84,7 @@ export default async function Console() {
<NativeSelect name="registration" defaultValue={settings.registration} aria-label="Registration">
<NativeSelectOption value="open">Open</NativeSelectOption>
<NativeSelectOption value="closed">Closed</NativeSelectOption>
<NativeSelectOption value="locked">Locked</NativeSelectOption>
</NativeSelect>
<SubmitButton pendingLabel="Setting…">Set</SubmitButton>
</div>
+7 -1
View File
@@ -24,7 +24,13 @@ export default async function RootLayout({ children }: { children: React.ReactNo
<StagingBanner />
<Header />
<main className="mx-auto w-full max-w-5xl flex-1 px-4 py-10 sm:px-6 sm:py-14">
{me?.kind === "basic" ? (
{me?.kind === "basic" && !me.approved ? (
// Only while registration is locked (staging): Discord sign-ins wait for approval too.
<NarrowCard
title="Waiting for Approval"
description={`You're signed in with Discord as ${me.username}. A moderator will approve your account soon; until then you can't use the hub or T5DE's other sites.`}
/>
) : me?.kind === "basic" ? (
<NarrowCard
title="Finish Setting Up Your Account"
description={`You're signed in with Discord as ${me.username}. Choose a username and password to use the hub; T5DE's other sites already work with your Discord sign-in.`}
+1 -1
View File
@@ -10,7 +10,7 @@ export default async function SignUp() {
if (await getMe()) redirect("/account");
const { registration } = unwrap(await api.hub.get());
const description =
registration === "closed"
registration !== "open"
? "One T5DE account for all your IMVU accounts. New accounts need a moderator's approval."
: "One T5DE account for all your IMVU accounts.";
return (