diff --git a/backend/main.go b/backend/main.go index 0d3ad68dc..350b45bed 100644 --- a/backend/main.go +++ b/backend/main.go @@ -38,7 +38,7 @@ func main() { modules := initModules(db, cfg) - adminEmail := env.String("UTMSTACK_ADMIN_EMAIL", "admin@localhost", false) + adminEmail := env.String("UTMSTACK_ADMIN_EMAIL", "admin", false) created, err := modules.tenant.GetBootstrapUsecase().EnsureDefaultTenant( appCtx, adminEmail, env.String("UTMSTACK_ADMIN_PASSWORD", "", false)) if err != nil { diff --git a/frontend/src/features/onboarding/AdminSetupGate.tsx b/frontend/src/features/onboarding/AdminSetupGate.tsx index 27ddde6e8..7179e683a 100644 --- a/frontend/src/features/onboarding/AdminSetupGate.tsx +++ b/frontend/src/features/onboarding/AdminSetupGate.tsx @@ -8,9 +8,9 @@ import { Input } from '@/shared/components/ui/input' import { IS_FEDERATION } from '@/shared/config/mode' import { useAuth } from '@/features/auth' -// The seeded admin ships with this placeholder address; treat it (and an empty +// The seeded admin ships with the placeholder "admin"; treat it (and an empty // email) as "not configured yet". -const DEFAULT_ADMIN_EMAIL = 'admin@localhost' +const DEFAULT_ADMIN_EMAIL = 'admin' function needsAdminEmail(email: string | undefined): boolean { const e = (email ?? '').trim().toLowerCase() @@ -21,7 +21,7 @@ const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ /** * First-run blocking gate (ported from v11): an admin still on the default email - * (admin@localhost) must set a real address before using the app — password + * ("admin") must set a real address before using the app — password * reset, notifications, alert emails and threat-intel registration all depend on * it. The modal can't be dismissed; after saving, the admin is guided to the * mail-server settings (non-blocking). Instance mode only — the federation diff --git a/installer/services/postgres.go b/installer/services/postgres.go index 8a643f01f..d963c367a 100644 --- a/installer/services/postgres.go +++ b/installer/services/postgres.go @@ -69,13 +69,13 @@ func GetAdminEmail() (string, error) { containerID := containerIDs[0] // The instance's administrator: the platform tenant's oldest active admin. - // "admin@localhost" is the placeholder the backend creates when nobody - // supplied an address, so it is not an answer. + // "admin" is the placeholder the backend creates when nobody supplied an + // address, so it is not an answer. query := `SELECT u.email FROM "user" u ` + `JOIN user_role ur ON ur.user_id = u.id ` + `JOIN role r ON r.id = ur.role_id AND r.name = 'ROLE_ADMIN' ` + `WHERE u.tenant_id = '` + defaultTenantID + `' ` + - `AND u.status = 'active' AND u.email <> 'admin@localhost' ` + + `AND u.status = 'active' AND u.email <> 'admin' ` + `ORDER BY u.created_at LIMIT 1` output, err := utils.RunCmdWithOutput("docker", "exec", containerID, "psql", "-U", "postgres", "-d", "utmstack", "-t", "-c", query) if err != nil {