Skip to content

Commit

Permalink
fix form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronleopold committed Jan 8, 2025
1 parent d308fd7 commit 7143567
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const buildSchema = (
.refine(
(value) =>
(!!editingUser && value === editingUser.username) ||
existingUsers.every((user) => user.username !== value),
existingUsers.every((user) => user.username.toLowerCase() !== value.toLowerCase()),
() => ({
message: t(
'settingsScene.server/users.createOrUpdateForm.validation.usernameAlreadyExists',
Expand Down
5 changes: 4 additions & 1 deletion packages/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,10 @@
}
},
"validation": {
"ageRestrictionTooLow": "Age restriction cannot be less than 0"
"ageRestrictionTooLow": "Age restriction cannot be less than 0",
"missingUsername": "Username is required",
"missingPassword": "Password is required",
"usernameAlreadyExists": "Username already exists"
},
"createSubmitButton": "Create user",
"updateSubmitButton": "Update user"
Expand Down

0 comments on commit 7143567

Please sign in to comment.