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

66 lines2,369 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";
Social cards for every page: og.g1t.sh5import { page } from "../lib/meta";
Email verification, password reset, and Git for AI scale positioning6import { ButtonLink } from "../components/ui";
7import { identity } from "../lib/services.server";
8import { assertSameOrigin, requireUser } from "../lib/session.server";
9
Social cards for every page: og.g1t.sh10export function meta(args: Route.MetaArgs) {
11 return page(args, { title: "Confirm your email · g1t" });
Email verification, password reset, and Git for AI scale positioning12}
13
14/** Follows the link from the confirmation email. */
15export 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. */
24export async function action({ request, context }: Route.ActionArgs) {
25 assertSameOrigin(request);
26 await identity.resendVerification(requireUser(context, request));
27 throw redirect("/?sent=1");
28}
29
30export 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 shell40 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 positioning42 </p>
43 <div className="mt-8">
Agents as a team: lifecycle, merge queue, billing and a new shell44 <ButtonLink to="/">Continue</ButtonLink>
Email verification, password reset, and Git for AI scale positioning45 </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}