Files
crosscode-platform/apps/accounts/frontend/src/app/reset/Reset.tsx
T
joshuaandClaude Opus 5.5 70c471666b Accounts sign-in looks like the church's site; Events sends its logo and colours
- @crosscode/ui: Shell with the church's colour wash, logo (or its initial)
  and name, footer; Card edged in the church's colour; Heading with an
  icon tile. Icons on every sign-in step.
- contracts 1.9.0: churchLookSchema (logo, accent colour) in import.begin;
  church.branding request. Accounts fills (move) or replaces (button) the
  church profile's name, logo and colours.
- Events 3.1.0: src/accounts/look.ts (logo as a full address), sent with a
  move; Settings -> Sign-in "Use this site's logo and colours".
Tests: Accounts 55, contracts 218, Events 774, test:accounts 16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 21:50:02 +02:00

35 lines
1.7 KiB
TypeScript

"use client";
import { KeyRound } from "lucide-react";
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 icon={<KeyRound className="h-5 w-5" />} 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; returnUrl: 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), to the product that made the
// account (its sign-in brings them straight back here signed in), or to the account page.
window.location.assign(r.data.uid ? `/signin?uid=${encodeURIComponent(r.data.uid)}` : r.data.returnUrl ?? 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>
);
}