import { Button, Input } from "@refs/design-system"; import { MIN_PASSWORD_LENGTH } from "@refs/backend/contract"; import { Form, Link, redirect, useNavigation } from "react-router"; import type { Route } from "./+types/reset-password"; import { AuthPage } from "../components/shell"; import { failed, gate, sessionCookie } from "../lib/session"; export const meta: Route.MetaFunction = () => [{ title: "Choose a new password ยท refs" }, { name: "referrer", content: "no-referrer" }]; export async function action({ request, params, context }: Route.ActionArgs) { const form = await request.formData(); const outcome = await gate(context).resetPassword({ token: params.token, password: String(form.get("password") ?? "") }); if (!outcome.ok) return failed(outcome.problem, {}); throw redirect("/", { headers: { "Set-Cookie": sessionCookie(outcome.value) } }); } export default function ResetPassword({ actionData }: Route.ComponentProps) { const submitting = useNavigation().state === "submitting"; return (

Link expired?{" "} Send a new one

); }