feat(site): /start creates an account, not an instance
The form posts to admin's signup and the slug preview goes: there is no instance at this point, and previewing one promises something the submission does not create. Creating the instance is now a step in the portal, which the page's What happens next panel spells out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,20 +2,11 @@
|
||||
|
||||
import { useState } from "react";
|
||||
import { Honeypot } from "@/components/Honeypot";
|
||||
import { submitSignup, type SubmitResult } from "@/lib/submit";
|
||||
import { submitAccountSignup, type SubmitResult } from "@/lib/submit";
|
||||
|
||||
const MIN_PASSWORD = 12;
|
||||
|
||||
function slugify(value: string) {
|
||||
return value
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/[^a-z0-9]+/g, "-")
|
||||
.replace(/^-|-$/g, "");
|
||||
}
|
||||
|
||||
export function InstanceForm() {
|
||||
const [slug, setSlug] = useState("");
|
||||
export function AccountForm() {
|
||||
const [result, setResult] = useState<SubmitResult>({ state: "idle" });
|
||||
const sending = result.state === "sending";
|
||||
|
||||
@@ -24,8 +15,8 @@ export function InstanceForm() {
|
||||
const data = new FormData(event.currentTarget);
|
||||
setResult({ state: "sending" });
|
||||
setResult(
|
||||
await submitSignup({
|
||||
instance_name: String(data.get("instance_name") ?? ""),
|
||||
await submitAccountSignup({
|
||||
name: String(data.get("name") ?? ""),
|
||||
email: String(data.get("email") ?? ""),
|
||||
password: String(data.get("password") ?? ""),
|
||||
website: String(data.get("website") ?? ""),
|
||||
@@ -38,7 +29,7 @@ export function InstanceForm() {
|
||||
<div role="status">
|
||||
<h2 style={{ fontSize: "var(--s-1)" }}>Check your email.</h2>
|
||||
<p style={{ color: "var(--ink-2)", marginTop: "0.5rem" }}>
|
||||
We sent a confirmation link. Open it and <b>{slug || "your instance"}</b> is created with you as its owner. The link works once and expires in 24 hours.
|
||||
We sent a confirmation link. Open it and your Vantage account is ready — then you can create your first instance from the portal. The link works once and expires in 24 hours.
|
||||
</p>
|
||||
<p style={{ color: "var(--ink-3)", marginTop: "0.75rem", fontSize: "0.88rem" }}>
|
||||
Nothing exists until you confirm if the email does not arrive, start again or contact support@hostxtra.co.uk.
|
||||
@@ -54,14 +45,11 @@ export function InstanceForm() {
|
||||
<Honeypot />
|
||||
|
||||
<div className="field">
|
||||
<label htmlFor="o-instance">Instance name</label>
|
||||
<input id="o-instance" name="instance_name" type="text" placeholder="Northgate Systems" required onChange={(e) => setSlug(slugify(e.target.value))} aria-describedby="o-instance-err" />
|
||||
<span className="hostline">
|
||||
<b>{slug || "your-instance"}</b>.vantage.hostxtra.co.uk
|
||||
</span>
|
||||
{fieldError("instance_name") && (
|
||||
<small id="o-instance-err" className="field__err">
|
||||
{fieldError("instance_name")}
|
||||
<label htmlFor="o-name">Your organisation</label>
|
||||
<input id="o-name" name="name" type="text" placeholder="Northgate Systems" required aria-describedby="o-name-err" />
|
||||
{fieldError("name") && (
|
||||
<small id="o-name-err" className="field__err">
|
||||
{fieldError("name")}
|
||||
</small>
|
||||
)}
|
||||
</div>
|
||||
Reference in New Issue
Block a user