"use client"; import { useState } from "react"; export default function SignupForm() { const [orgName, setOrgName] = useState(""); const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const [err, setErr] = useState(null); const [verificationSent, setVerificationSent] = useState(false); const [emailSent, setEmailSent] = useState(true); async function onSubmit(e: React.FormEvent) { e.preventDefault(); setErr(null); setLoading(true); try { const res = await fetch("/api/signup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ orgName, name, email, password }), }); const data = await res.json().catch(() => ({})); if (!res.ok || !data.ok) { setErr(data.error || "Signup failed"); return; } setVerificationSent(true); setEmailSent(data.emailSent !== false); } catch (e: any) { setErr(e?.message || "Network error"); } finally { setLoading(false); } } if (verificationSent) { return (

Verify your email

We sent a verification link to {email}.

{!emailSent && (
Verification email failed to send. Please contact support.
)}
Once verified, you can sign in and invite your team.
Back to login
); } return (

Create your Control Tower

Set up your organization and invite the team.

setOrgName(e.target.value)} autoComplete="organization" />
setName(e.target.value)} autoComplete="name" />
setEmail(e.target.value)} autoComplete="email" />
setPassword(e.target.value)} autoComplete="new-password" />
{err &&
{err}
}
Already have access?{" "} Sign in
); }