use regex to validate name on frontend

This commit is contained in:
Josh Hawkins 2025-05-17 11:15:37 -05:00
parent 88629cfddb
commit 0af58caf1c
2 changed files with 4 additions and 1 deletions

View File

@ -1,7 +1,8 @@
{ {
"description": { "description": {
"addFace": "Walk through adding a new collection to the Face Library.", "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": { "details": {
"person": "Person", "person": "Person",

View File

@ -119,6 +119,8 @@ export default function CreateFaceWizardDialog({
setName(name); setName(name);
setStep(1); setStep(1);
}} }}
regexPattern={/^[\p{L}\p{N}\s'_-]{1,50}$/u}
regexErrorMessage={t("description.invalidName")}
> >
<div className="flex justify-end py-2"> <div className="flex justify-end py-2">
<Button variant="select" type="submit"> <Button variant="select" type="submit">