From 4319118e947b6ca49c9bb408d2a0b129abe78b9b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sun, 19 Oct 2025 06:21:15 -0500 Subject: [PATCH] enforce at least one letter in zone names (#20561) --- web/public/locales/en/views/settings.json | 5 +++-- web/src/components/settings/ZoneEditPane.tsx | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json index 16290ea80..8a64533b3 100644 --- a/web/public/locales/en/views/settings.json +++ b/web/public/locales/en/views/settings.json @@ -385,7 +385,8 @@ "mustNotBeSameWithCamera": "Zone name must not be the same as camera name.", "alreadyExists": "A zone with this name already exists for this camera.", "mustNotContainPeriod": "Zone name must not contain periods.", - "hasIllegalCharacter": "Zone name contains illegal characters." + "hasIllegalCharacter": "Zone name contains illegal characters.", + "mustHaveAtLeastOneLetter": "Zone name must have at least one letter." } }, "distance": { @@ -443,7 +444,7 @@ "name": { "title": "Name", "inputPlaceHolder": "Enter a name…", - "tips": "Name must be at least 2 characters and must not be the name of a camera or another zone." + "tips": "Name must be at least 2 characters, must have at least one letter, and must not be the name of a camera or another zone." }, "inertia": { "title": "Inertia", diff --git a/web/src/components/settings/ZoneEditPane.tsx b/web/src/components/settings/ZoneEditPane.tsx index 67f5f690a..8a1e36a0e 100644 --- a/web/src/components/settings/ZoneEditPane.tsx +++ b/web/src/components/settings/ZoneEditPane.tsx @@ -149,6 +149,11 @@ export default function ZoneEditPane({ ) .refine((value: string) => /^[a-zA-Z0-9_-]+$/.test(value), { message: t("masksAndZones.form.zoneName.error.hasIllegalCharacter"), + }) + .refine((value: string) => /[a-zA-Z]/.test(value), { + message: t( + "masksAndZones.form.zoneName.error.mustHaveAtLeastOneLetter", + ), }), inertia: z.coerce .number()