Skip to content

Commit 0af2626

Browse files
committed
496: Add maximum length for name and username
1 parent 60c66f4 commit 0af2626

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/client/src/pages/UserManagement/Validations.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const buildNameValidation = () => {
1111
return Yup.string()
1212
.trim()
1313
.min(2, "Name must be at least 2 characters")
14+
.max(50, "Name cannot be more than 50 characters")
1415
.matches(/^(?!.* )[a-zA-Z ]+$/, "Name must only contain letters and non-consecutive internal spaces")
1516
.required("Name is required")
1617
}
@@ -19,6 +20,7 @@ export const buildUsernameValidation = () => {
1920
return Yup.string()
2021
.trim()
2122
.min(2, "Username must be at least 2 characters")
23+
.max(50, "Username cannot be more than 50 characters")
2224
.matches(/^[a-zA-Z0-9].*$/, "Username must begin with a letter or number")
2325
.matches(/^.*[a-zA-Z0-9]$/, "Username must end with a letter or number")
2426
.matches(/^(?!.*?__)[a-zA-Z0-9_]+$/, "Username must contain only alphanumeric characters and non-consecutive underscores")

0 commit comments

Comments
 (0)