show a specific error for dot-only usernames

Entering "." or ".." in the create user dialog showed the message listing periods as allowed characters, which didn't explain the rejection. The dialog now checks for dot-only names separately and shows its own message.
This commit is contained in:
Josh Hawkins
2026-10-09 23:59:36 -05:00
parent ec9319853f
commit b78d65565b
2 changed files with 5 additions and 1 deletions
@@ -1054,6 +1054,7 @@
"title": "Create New User", "title": "Create New User",
"desc": "Add a new user account and specify a role for access to areas of the Frigate UI.", "desc": "Add a new user account and specify a role for access to areas of the Frigate UI.",
"usernameOnlyInclude": "Username may only include letters, numbers, . or _", "usernameOnlyInclude": "Username may only include letters, numbers, . or _",
"usernameOnlyDots": "Username cannot contain only periods",
"confirmPassword": "Please confirm your password" "confirmPassword": "Please confirm your password"
}, },
"deleteUser": { "deleteUser": {
@@ -80,8 +80,11 @@ export default function CreateUserDialog({
user: z user: z
.string() .string()
.min(1, t("users.dialog.form.usernameIsRequired")) .min(1, t("users.dialog.form.usernameIsRequired"))
.regex(/^(?!\.+$)[A-Za-z0-9._]+$/, { .regex(/^[A-Za-z0-9._]+$/, {
message: t("users.dialog.createUser.usernameOnlyInclude"), message: t("users.dialog.createUser.usernameOnlyInclude"),
})
.regex(/[^.]/, {
message: t("users.dialog.createUser.usernameOnlyDots"),
}), }),
password: z password: z
.string() .string()