From 0af58caf1c27d28813af2d1c8599575e9416df9d Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Sat, 17 May 2025 11:15:37 -0500 Subject: [PATCH] use regex to validate name on frontend --- web/public/locales/en/views/faceLibrary.json | 3 ++- web/src/components/overlay/detail/FaceCreateWizardDialog.tsx | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/public/locales/en/views/faceLibrary.json b/web/public/locales/en/views/faceLibrary.json index feffa796c..e734ca974 100644 --- a/web/public/locales/en/views/faceLibrary.json +++ b/web/public/locales/en/views/faceLibrary.json @@ -1,7 +1,8 @@ { "description": { "addFace": "Walk through adding a new collection to the Face Library.", - "placeholder": "Enter a name for this collection" + "placeholder": "Enter a name for this collection", + "invalidName": "Invalid name. Names can only include letters, numbers, spaces, apostrophes, underscores, and hyphens." }, "details": { "person": "Person", diff --git a/web/src/components/overlay/detail/FaceCreateWizardDialog.tsx b/web/src/components/overlay/detail/FaceCreateWizardDialog.tsx index 9fb3c9fad..d1ebf21a8 100644 --- a/web/src/components/overlay/detail/FaceCreateWizardDialog.tsx +++ b/web/src/components/overlay/detail/FaceCreateWizardDialog.tsx @@ -119,6 +119,8 @@ export default function CreateFaceWizardDialog({ setName(name); setStep(1); }} + regexPattern={/^[\p{L}\p{N}\s'_-]{1,50}$/u} + regexErrorMessage={t("description.invalidName")} >