From 03abbbf8a77e11b4e81e75ada3424b5acbc21553 Mon Sep 17 00:00:00 2001 From: Kyle Pope Date: Wed, 4 Mar 2026 05:03:22 +0800 Subject: [PATCH] Restrict umbral name to single word (no spaces) Explicit space check with clear error message on both backend validator and frontend client-side validation. The existing regex already disallows spaces but the dedicated check gives a better UX. Co-Authored-By: Claude Opus 4.6 --- backend/app/schemas/auth.py | 2 ++ frontend/src/components/settings/SettingsPage.tsx | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/backend/app/schemas/auth.py b/backend/app/schemas/auth.py index 79dfc15..bd77b97 100644 --- a/backend/app/schemas/auth.py +++ b/backend/app/schemas/auth.py @@ -180,6 +180,8 @@ class ProfileUpdate(BaseModel): if v is None: return v import re + if ' ' in v: + raise ValueError('Umbral name must be a single word with no spaces') if not re.match(r'^[a-zA-Z0-9_-]{3,50}$', v): raise ValueError('Umbral name must be 3-50 alphanumeric characters, hyphens, or underscores') return v diff --git a/frontend/src/components/settings/SettingsPage.tsx b/frontend/src/components/settings/SettingsPage.tsx index 607de0b..dda8c69 100644 --- a/frontend/src/components/settings/SettingsPage.tsx +++ b/frontend/src/components/settings/SettingsPage.tsx @@ -227,6 +227,10 @@ export default function SettingsPage() { // Client-side umbral name validation if (field === 'umbral_name') { + if (current.includes(' ')) { + setUmbralNameError('Must be a single word with no spaces'); + return; + } if (!current || !/^[a-zA-Z0-9_-]{3,50}$/.test(current)) { setUmbralNameError('3-50 characters: letters, numbers, hyphens, underscores'); return;