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,32 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { call, selfSignIn } from "@/lib/api";
|
||||
|
||||
export function Reset({ token }: { token: string | null }) {
|
||||
const branding = useBranding();
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<Card>
|
||||
<Heading sub="At least 8 characters.">Choose a new password</Heading>
|
||||
{error && <Notice tone="error">{error}</Notice>}
|
||||
<form onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
setBusy(true);
|
||||
const r = await call<{ uid: string | null }>("POST", "/password/reset", { token, password: new FormData(e.currentTarget).get("password") });
|
||||
setBusy(false);
|
||||
if (!r.ok) return setError(r.error.message);
|
||||
// Back to the sign-in it started from (and on to that site), or to the account page.
|
||||
window.location.assign(r.data.uid ? `/signin?uid=${encodeURIComponent(r.data.uid)}` : selfSignIn("/account"));
|
||||
}}>
|
||||
<Field label="New password" name="password" type="password" autoComplete="new-password" required minLength={8} autoFocus />
|
||||
<Button type="submit" busy={busy} className="w-full">Save and sign in</Button>
|
||||
</form>
|
||||
</Card>
|
||||
</Shell>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user