g1t/apps/web/app/routes/forgot.tsx
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Email verification, password reset, and Git for AI scale positioning | 1 | import { Form, Link } from "react-router"; |
| 2 | ||
| 3 | import type { Route } from "./+types/forgot"; | |
| Social cards for every page: og.g1t.sh | 4 | import { page } from "../lib/meta"; |
| Email verification, password reset, and Git for AI scale positioning | 5 | import { AuthCard } from "../components/auth-card"; |
| 6 | import { Button, Field, Input } from "../components/ui"; | |
| 7 | import { identity } from "../lib/services.server"; | |
| 8 | import { assertSameOrigin } from "../lib/session.server"; | |
| 9 | ||
| Social cards for every page: og.g1t.sh | 10 | export function meta(args: Route.MetaArgs) { |
| 11 | return page(args, { title: "Reset your password · g1t" }); | |
| Email verification, password reset, and Git for AI scale positioning | 12 | } |
| 13 | ||
| 14 | export async function action({ request }: Route.ActionArgs) { | |
| 15 | assertSameOrigin(request); | |
| 16 | const form = await request.formData(); | |
| 17 | await identity.requestPasswordReset(String(form.get("email") ?? "")); | |
| 18 | return { sent: true }; | |
| 19 | } | |
| 20 | ||
| 21 | export default function Forgot({ actionData }: Route.ComponentProps) { | |
| 22 | return ( | |
| 23 | <AuthCard | |
| 24 | title="Forgot your password?" | |
| 25 | subtitle="We will email you a link" | |
| 26 | footer={ | |
| 27 | <Link to="/login" className="text-fg underline underline-offset-4"> | |
| 28 | Back to sign in | |
| 29 | </Link> | |
| 30 | } | |
| 31 | > | |
| 32 | {actionData?.sent ? ( | |
| 33 | <p className="rounded-lg border border-line bg-surface p-4 text-sm leading-6"> | |
| 34 | If that address has an account, a reset link is on its way. It works | |
| 35 | for one hour. | |
| 36 | </p> | |
| 37 | ) : ( | |
| 38 | <Form method="post" className="space-y-4"> | |
| 39 | <Field label="Email"> | |
| 40 | <Input name="email" type="email" autoComplete="email" required autoFocus /> | |
| 41 | </Field> | |
| 42 | <div className="pt-2 *:w-full"> | |
| 43 | <Button type="submit">Send reset link</Button> | |
| 44 | </div> | |
| 45 | </Form> | |
| 46 | )} | |
| 47 | </AuthCard> | |
| 48 | ); | |
| 49 | } |