Accounts 1.0.0 frontend and @crosscode/ui

Sign-in steps (password, sign-up, email code, two-step sign-in and its
setup with recovery codes, privacy notice, news question), forgot and
reset password, the account page, admin (people, deletions, church
profile, linked products, settings, notice, licence, audit) and setup.
Strict CSP with a nonce per page; church colours from the profile.
@crosscode/ui gets its first components (shell, card, fields, buttons).
Plan: roles stay in each product (asked 2026-11-18).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 13:42:45 +02:00
co-authored by Claude Opus 5.5
parent a888260f01
commit f202a5a88e
36 changed files with 1521 additions and 5 deletions
@@ -0,0 +1,36 @@
"use client";
import React, { useState } from "react";
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
import { useBranding } from "@/components/BrandingProvider";
import { call } from "@/lib/api";
export function Forgot({ uid }: { uid: string | null }) {
const branding = useBranding();
const [sent, setSent] = useState(false);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
return (
<Shell branding={branding}>
<Card>
<Heading sub="We'll email you a link to choose a new one.">Forgot your password?</Heading>
{sent ? (
<Notice tone="success">If there&apos;s an account with that email address, a link is on its way. It works for an hour. You can close this page: the link brings you back.</Notice>
) : (
<form onSubmit={async (e) => {
e.preventDefault();
setBusy(true);
const r = await call("POST", "/password/forgot", { email: new FormData(e.currentTarget).get("email"), uid: uid ?? undefined });
setBusy(false);
if (r.ok) setSent(true); else setError(r.error.message);
}}>
{error && <Notice tone="error">{error}</Notice>}
<Field label="Email address" name="email" type="email" autoComplete="email" required autoFocus />
<Button type="submit" busy={busy} className="w-full">Send the link</Button>
</form>
)}
{uid && <p className="mt-4 text-sm"><a href={`/signin?uid=${encodeURIComponent(uid)}`} className="text-brand underline">Back to sign in</a></p>}
</Card>
</Shell>
);
}
@@ -0,0 +1,8 @@
import { Forgot } from "./Forgot";
export const metadata = { title: "Forgot your password" };
export default async function Page({ searchParams }: { searchParams: Promise<{ uid?: string }> }) {
const { uid } = await searchParams;
return <Forgot uid={uid ?? null} />;
}