()
| 13 | // invite-gated and this page is never shown again. The auth gate renders this |
| 14 | // when /api/setup-status reports the instance still needs setup. |
| 15 | export const SetupPage = () => { |
| 16 | const [name, setName] = useState(""); |
| 17 | const [email, setEmail] = useState(""); |
| 18 | const [password, setPassword] = useState(""); |
| 19 | const [error, setError] = useState<string | null>(null); |
| 20 | const [busy, setBusy] = useState(false); |
| 21 | |
| 22 | const submit = async (event: FormEvent) => { |
| 23 | event.preventDefault(); |
| 24 | setBusy(true); |
| 25 | setError(null); |
| 26 | const result = await authClient.signUp.email({ name, email, password }); |
| 27 | if (result.error) { |
| 28 | setBusy(false); |
| 29 | setError(result.error.message ?? "Could not create the admin account."); |
| 30 | return; |
| 31 | } |
| 32 | window.location.href = "/"; |
| 33 | }; |
| 34 | |
| 35 | return ( |
| 36 | <AuthLayout> |
| 37 | <form |
| 38 | onSubmit={submit} |
| 39 | className="w-full max-w-sm space-y-4 rounded-xl border border-border bg-card p-6 shadow-sm" |
| 40 | > |
| 41 | <div className="space-y-1"> |
| 42 | <h1 className="text-xl font-semibold tracking-tight text-foreground">Set up Executor</h1> |
| 43 | <p className="text-sm text-muted-foreground"> |
| 44 | Create the admin account for this instance. You can invite your team once you're in. |
| 45 | </p> |
| 46 | </div> |
| 47 | |
| 48 | <div className="space-y-1.5"> |
| 49 | <Label htmlFor="name">Name</Label> |
| 50 | <Input |
| 51 | id="name" |
| 52 | placeholder="Your name" |
| 53 | value={name} |
| 54 | onChange={(e) => setName((e.target as HTMLInputElement).value)} |
| 55 | autoComplete="name" |
| 56 | required |
| 57 | /> |
| 58 | </div> |
| 59 | <div className="space-y-1.5"> |
| 60 | <Label htmlFor="email">Email</Label> |
| 61 | <Input |
| 62 | id="email" |
| 63 | type="email" |
| 64 | placeholder="you@example.com" |
| 65 | value={email} |
| 66 | onChange={(e) => setEmail((e.target as HTMLInputElement).value)} |
| 67 | autoComplete="email" |
| 68 | required |
| 69 | /> |
| 70 | </div> |
| 71 | <div className="space-y-1.5"> |
| 72 | <Label htmlFor="password">Password</Label> |
nothing calls this directly
no test coverage detected