Locks staging down before payments' staging (PayPal's sandbox) exists. **The problem:** staging's registration is closed, but signing in with Discord still makes an approved basic account at once (`auth.ts`). So any Discord account can sign in to Music's staging. **The change:** a third registration setting, `locked`: - Every new account waits for a moderator's approval, Discord sign-ins too. - Only approved accounts sign in to T5DE's other sites. The gate is the OAuth provider's `postLogin.shouldRedirect`: an unapproved account is sent to the website (which shows "Waiting for Approval") and no code is issued. It runs on every authorize request and on `/oauth2/continue`. - Finishing setup under `locked` keeps the person's approval, so an approved basic account doesn't lose Music access by becoming a member. - **Console:** the setting has a "Locked" option. **Website:** the waiting screen for unapproved Discord accounts, and the sign-up page's note. `open` and `closed` behave as before. Under `closed`, a member waiting for approval still signs in to Music (tested), so prod doesn't change. **After merging:** infra sets staging's `REGISTRATION` to `locked`. That's only a default: if staging's registration was ever changed in the console, set it to Locked there. Accounts already on staging keep their approval. **Checks:** `bun test` (77 pass, two new tests), `check-types`, `lint`. Locks staging down before payments' staging (PayPal's sandbox) exists. **The problem:** staging's registration is closed, but signing in with Discord still makes an approved basic account at once (`auth.ts`). So any Discord account can sign in to Music's staging. **The change:** a third registration setting, `locked`: - Every new account waits for a moderator's approval, Discord sign-ins too. - Only approved accounts sign in to T5DE's other sites. The gate is the OAuth provider's `postLogin.shouldRedirect`: an unapproved account is sent to the website (which shows "Waiting for Approval") and no code is issued. It runs on every authorize request and on `/oauth2/continue`. - Finishing setup under `locked` keeps the person's approval, so an approved basic account doesn't lose Music access by becoming a member. - **Console:** the setting has a "Locked" option. **Website:** the waiting screen for unapproved Discord accounts, and the sign-up page's note. `open` and `closed` behave as before. Under `closed`, a member waiting for approval still signs in to Music (tested), so prod doesn't change. **After merging:** infra sets staging's `REGISTRATION` to `locked`. That's only a default: if staging's registration was ever changed in the console, set it to Locked there. Accounts already on staging keep their approval. **Checks:** `bun test` (77 pass, two new tests), `check-types`, `lint`. Co-authored-by: dhkatz <[email protected]>
58 lines
2.4 KiB
TypeScript
58 lines
2.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import { Header } from "@/components/header";
|
|
import { NarrowCard } from "@/components/narrow-card";
|
|
import { StagingBanner } from "@/components/staging-banner";
|
|
import { getMe } from "@/lib/api";
|
|
import { FinishSetupForm } from "./account/finish-setup-form";
|
|
import { cn } from "@/lib/utils";
|
|
import "./globals.css";
|
|
|
|
const sans = Geist({ subsets: ["latin"], variable: "--font-sans" });
|
|
const mono = Geist_Mono({ subsets: ["latin"], variable: "--font-mono" });
|
|
|
|
export const metadata: Metadata = {
|
|
title: { template: "%s · T5DE Hub", default: "T5DE Hub" },
|
|
description: "One account for all your IMVU avatars.",
|
|
};
|
|
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const me = await getMe();
|
|
return (
|
|
<html lang="en" className={cn("font-sans antialiased", sans.variable, mono.variable)}>
|
|
<body className="flex min-h-dvh flex-col">
|
|
<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.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.`}
|
|
>
|
|
<FinishSetupForm />
|
|
</NarrowCard>
|
|
) : me && !me.approved ? (
|
|
<NarrowCard
|
|
title="Waiting for Approval"
|
|
description={`Thanks for signing up, ${me.username}. A moderator will approve your account soon; until then you can't use the hub.`}
|
|
/>
|
|
) : (
|
|
children
|
|
)}
|
|
</main>
|
|
<footer className="border-t">
|
|
<div className="mx-auto max-w-5xl px-4 py-6 text-sm text-muted-foreground sm:px-6">
|
|
T5DE is unofficial: not made by or affiliated with IMVU.
|
|
</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|