From 1da5c5ff12b7b024a392b167c10fcb190d4bd599 Mon Sep 17 00:00:00 2001 From: Shyam Kumar Date: Mon, 18 May 2026 23:10:10 +0200 Subject: [PATCH 1/4] add org name to the setup step --- pkg/public/setup_owner.go | 7 +++++- web_src/src/pages/auth/OwnerSetup.tsx | 4 ++++ .../src/pages/auth/ownerSetup/OwnerStep.tsx | 22 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/pkg/public/setup_owner.go b/pkg/public/setup_owner.go index 08c95fa0b8..2a680d090f 100644 --- a/pkg/public/setup_owner.go +++ b/pkg/public/setup_owner.go @@ -24,6 +24,7 @@ type SetupOwnerRequest struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Password string `json:"password"` + OrganizationName string `json:"organization_name"` SMTPEnabled bool `json:"smtp_enabled"` SMTPHost string `json:"smtp_host"` SMTPPort int `json:"smtp_port"` @@ -62,6 +63,10 @@ func (s *Server) setupOwner(w http.ResponseWriter, r *http.Request) { return } + if req.OrganizationName == "" { + req.OrganizationName = "Demo" + } + if req.SMTPEnabled { if req.SMTPHost == "" || req.SMTPPort == 0 || req.SMTPFromEmail == "" { http.Error(w, "SMTP host, port, and from email are required", http.StatusBadRequest) @@ -110,7 +115,7 @@ func (s *Server) setupOwner(w http.ResponseWriter, r *http.Request) { return err } - organization, err = models.CreateOrganizationInTransaction(tx, "Demo", "") + organization, err = models.CreateOrganizationInTransaction(tx, req.OrganizationName, "") if err != nil { return err } diff --git a/web_src/src/pages/auth/OwnerSetup.tsx b/web_src/src/pages/auth/OwnerSetup.tsx index d09a426d1e..84a304e8e5 100644 --- a/web_src/src/pages/auth/OwnerSetup.tsx +++ b/web_src/src/pages/auth/OwnerSetup.tsx @@ -10,6 +10,7 @@ const OWNER_SETUP_SURVEY_NAME = "Owner Setup Survey"; const OwnerSetup: React.FC = () => { const [email, setEmail] = useState(""); + const [organizationName, setOrganizationName] = useState("Demo"); const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [password, setPassword] = useState(""); @@ -115,6 +116,7 @@ const OwnerSetup: React.FC = () => { credentials: "include", body: JSON.stringify({ email: email.trim(), + organization_name: organizationName.trim(), first_name: firstName.trim(), last_name: lastName.trim(), password, @@ -233,6 +235,7 @@ const OwnerSetup: React.FC = () => { {step === "owner" && ( { error={error} fieldErrors={fieldErrors} onEmailChange={setEmail} + onOrganizationNameChange={setOrganizationName} onFirstNameChange={setFirstName} onLastNameChange={setLastName} onPasswordChange={setPassword} diff --git a/web_src/src/pages/auth/ownerSetup/OwnerStep.tsx b/web_src/src/pages/auth/ownerSetup/OwnerStep.tsx index 5cb4e0afb6..422b7abe73 100644 --- a/web_src/src/pages/auth/ownerSetup/OwnerStep.tsx +++ b/web_src/src/pages/auth/ownerSetup/OwnerStep.tsx @@ -8,6 +8,7 @@ import { ErrorBanner } from "./ErrorBanner"; type OwnerStepProps = { email: string; + organizationName: string; firstName: string; lastName: string; password: string; @@ -16,6 +17,7 @@ type OwnerStepProps = { error: string | null; fieldErrors: Record; onEmailChange: (value: string) => void; + onOrganizationNameChange: (value: string) => void; onFirstNameChange: (value: string) => void; onLastNameChange: (value: string) => void; onPasswordChange: (value: string) => void; @@ -25,6 +27,7 @@ type OwnerStepProps = { export const OwnerStep: React.FC = ({ email, + organizationName, firstName, lastName, password, @@ -33,6 +36,7 @@ export const OwnerStep: React.FC = ({ error, fieldErrors, onEmailChange, + onOrganizationNameChange, onFirstNameChange, onLastNameChange, onPasswordChange, @@ -47,6 +51,24 @@ export const OwnerStep: React.FC = ({
+
+ + + onOrganizationNameChange(event.target.value)} + placeholder="Acme Inc." + autoComplete="organization" + className={fieldErrors.organizationName ? "border-red-500" : ""} + /> + + {fieldErrors.organizationName && ( +

{fieldErrors.organizationName}

+ )} +
- +