g1t/apps/web/app/routes/verify.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 { CircleCheck, MailWarning } from "lucide-react"; |
| 2 | import { redirect } from "react-router"; | |
| 3 | ||
| 4 | import type { Route } from "./+types/verify"; | |
| Social cards for every page: og.g1t.sh | 5 | import { page } from "../lib/meta"; |
| Email verification, password reset, and Git for AI scale positioning | 6 | import { ButtonLink } from "../components/ui"; |
| 7 | import { identity } from "../lib/services.server"; | |
| 8 | import { assertSameOrigin, requireUser } 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: "Confirm your email · g1t" }); | |
| Email verification, password reset, and Git for AI scale positioning | 12 | } |
| 13 | ||
| 14 | /** Follows the link from the confirmation email. */ | |
| 15 | export async function loader({ request }: Route.LoaderArgs) { | |
| 16 | const token = new URL(request.url).searchParams.get("token") ?? ""; | |
| 17 | const result = await identity.verifyEmail(token); | |
| 18 | return result.ok | |
| 19 | ? { ok: true as const, username: result.value.username } | |
| 20 | : { ok: false as const, message: result.error.message }; | |
| 21 | } | |
| 22 | ||
| 23 | /** "Resend" from the banner shown to unconfirmed accounts. */ | |
| 24 | export async function action({ request, context }: Route.ActionArgs) { | |
| 25 | assertSameOrigin(request); | |
| 26 | await identity.resendVerification(requireUser(context, request)); | |
| 27 | throw redirect("/?sent=1"); | |
| 28 | } | |
| 29 | ||
| 30 | export default function Verify({ loaderData }: Route.ComponentProps) { | |
| 31 | return ( | |
| 32 | <main className="mx-auto max-w-md px-4 py-32 text-center"> | |
| 33 | {loaderData.ok ? ( | |
| 34 | <> | |
| 35 | <CircleCheck size={40} className="mx-auto text-accent" /> | |
| 36 | <h1 className="mt-6 text-2xl font-semibold tracking-tight"> | |
| 37 | Email confirmed | |
| 38 | </h1> | |
| 39 | <p className="mt-2 text-muted"> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 40 | Your account {loaderData.username} is ready. Next, create the |
| 41 | workspace your repositories will live in. | |
| Email verification, password reset, and Git for AI scale positioning | 42 | </p> |
| 43 | <div className="mt-8"> | |
| Agents as a team: lifecycle, merge queue, billing and a new shell | 44 | <ButtonLink to="/">Continue</ButtonLink> |
| Email verification, password reset, and Git for AI scale positioning | 45 | </div> |
| 46 | </> | |
| 47 | ) : ( | |
| 48 | <> | |
| 49 | <MailWarning size={40} className="mx-auto text-warn" /> | |
| 50 | <h1 className="mt-6 text-2xl font-semibold tracking-tight"> | |
| 51 | That link did not work | |
| 52 | </h1> | |
| 53 | <p className="mt-2 text-muted">{loaderData.message}</p> | |
| 54 | <p className="mt-2 text-sm text-muted"> | |
| 55 | Sign in and use the banner at the top to send a new one. | |
| 56 | </p> | |
| 57 | <div className="mt-8"> | |
| 58 | <ButtonLink to="/login" variant="quiet"> | |
| 59 | Sign in | |
| 60 | </ButtonLink> | |
| 61 | </div> | |
| 62 | </> | |
| 63 | )} | |
| 64 | </main> | |
| 65 | ); | |
| 66 | } |