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:
@@ -0,0 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { Card, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { call, selfSignIn } from "@/lib/api";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
|
||||
export function ConfirmEmail({ token }: { token: string }) {
|
||||
const branding = useBranding();
|
||||
const [state, setState] = useState<{ ok: boolean; text: string } | null>(null);
|
||||
useExternalEffect(() => {
|
||||
let alive = true;
|
||||
call("POST", "/me/email/confirm", { token }).then((r) => {
|
||||
if (!alive) return;
|
||||
if (r.status === 401) return window.location.assign(selfSignIn(`/account/confirm-email?token=${encodeURIComponent(token)}`));
|
||||
setState(r.ok ? { ok: true, text: "Your new email address is confirmed. Sign in with it from now on." } : { ok: false, text: r.error.message });
|
||||
});
|
||||
return () => { alive = false; };
|
||||
}, [token]);
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<Card>
|
||||
<Heading>Your email address</Heading>
|
||||
{state ? <Notice tone={state.ok ? "success" : "error"}>{state.text}</Notice> : <p className="text-gray-600">Confirming…</p>}
|
||||
<a href="/account" className="text-brand underline">Back to your account</a>
|
||||
</Card>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { ConfirmEmail } from "./ConfirmEmail";
|
||||
|
||||
export const metadata = { title: "Confirm your email address" };
|
||||
|
||||
export default async function Page({ searchParams }: { searchParams: Promise<{ token?: string }> }) {
|
||||
const { token } = await searchParams;
|
||||
return <ConfirmEmail token={token ?? ""} />;
|
||||
}
|
||||
Reference in New Issue
Block a user