Skip to content

Commit f935792

Browse files
author
pushpendu
committed
refactor:update the regex such that the username can be in a specific format
1 parent f7c79c9 commit f935792

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

middlewares/validators/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const updateUser = async (req, res, next) => {
1616
username: joi
1717
.string()
1818
.optional()
19-
.regex(/^[a-z0-9-]+$/)
19+
.regex(/^[a-z]+-[a-z]+(-[1-9])?$/)
2020
.message("Username must be lowercase only hypen, numbers are allowed."),
2121
first_name: joi.string().optional(),
2222
last_name: joi.string().optional(),

0 commit comments

Comments
 (0)