flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/web/app/routes/verify.tsx

65 lines2,321 bytesCodeBlame

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