crosscode: scripts/products/website.sh (ports 5300/3300, uploads in the export), crosscode add <church> website (needs Accounts; www.<address> or the Cross Code address), one install_app for Accounts and the Website, env template copy, bats tests. Backend: Hub client (protocol v2, product website), crosscode.link/1 with automatic connect to the church's Accounts, sign-in through @crosscode/auth-client with the Website's own session and roles, the first Owner from HUB_ADMIN_EMAIL (verified), 2FA for Owners and Admins, back-channel logout, Accounts' user.* calls, and the church export. Frontend: admin sign-in/out and the sign-in problem page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.0 KiB
TypeScript
27 lines
1.0 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { redirect } from "next/navigation";
|
|
import { loadMe, ROLE_NAMES, signInHref } from "@/lib/admin";
|
|
|
|
export const metadata: Metadata = { title: "Admin", robots: { index: false, follow: false } };
|
|
export const dynamic = "force-dynamic";
|
|
|
|
// The admin (docs/WEBSITE-1.0-PLAN.md §10), signed in through the church's Accounts. The screens
|
|
// (template and style, pages, messages, events, publish) come next.
|
|
export default async function Admin() {
|
|
const me = await loadMe();
|
|
if (!me) redirect(signInHref("/admin"));
|
|
return (
|
|
<main className="mx-auto max-w-xl px-4 py-16">
|
|
<h1 className="text-2xl font-semibold">Website admin</h1>
|
|
<p className="mt-2 text-gray-600">
|
|
Signed in as {me.user.name} ({me.user.email}), {ROLE_NAMES[me.user.role]}.
|
|
</p>
|
|
<form method="post" action="/api/auth/signout" className="mt-6">
|
|
<button type="submit" className="rounded border border-gray-300 px-4 py-2 text-sm hover:bg-gray-50">
|
|
Sign out
|
|
</button>
|
|
</form>
|
|
</main>
|
|
);
|
|
}
|