Skip to content

Commit

Permalink
Fix username character limit (#2113) (#2115)
Browse files Browse the repository at this point in the history
* chore: add 32 character limit for username

* chore: fix failing test

Co-authored-by: Amit Prakash <[email protected]>
  • Loading branch information
vinit717 and iamitprakash authored Aug 30, 2024
1 parent 1bcc6a8 commit f8fd064
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions middlewares/validators/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const updateUser = async (req, res, next) => {
.string()
.optional()
.min(4)
.max(20)
.max(32)
.regex(/^[a-zA-Z0-9-]+$/)
.message("Username must be between 4 and 20 characters long and contain only letters or numbers."),
.message("Username must be between 4 and 32 characters long and contain only letters or numbers."),
first_name: joi.string().optional(),
last_name: joi.string().optional(),
yoe: joi.number().min(0).optional(),
Expand Down
2 changes: 1 addition & 1 deletion test/integration/users.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ describe("Users", function () {
expect(res.body).to.eql({
statusCode: 400,
error: "Bad Request",
message: "Username must be between 4 and 20 characters long and contain only letters or numbers.",
message: "Username must be between 4 and 32 characters long and contain only letters or numbers.",
});

return done();
Expand Down

0 comments on commit f8fd064

Please sign in to comment.