Skip to content

Commit

Permalink
added the dot (.) username rules (danny-avila#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
berry-13 authored Aug 11, 2023
1 parent 91d32fa commit 1aa4b34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const userSchema = mongoose.Schema(
type: String,
lowercase: true,
required: [true, 'can\'t be blank'],
match: [/^[a-zA-Z0-9_-]+$/, 'is invalid'],
match: [/^[a-zA-Z0-9_.-]+$/, 'is invalid'],
index: true,
},
email: {
Expand Down Expand Up @@ -177,7 +177,7 @@ module.exports.validateUser = (user) => {
username: Joi.string()
.min(2)
.max(80)
.regex(/^[a-zA-Z0-9_-]+$/)
.regex(/^[a-zA-Z0-9_.-]+$/)
.required(),
password: Joi.string().min(8).max(128).allow('').allow(null),
};
Expand Down
2 changes: 1 addition & 1 deletion api/strategies/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const registerSchema = Joi.object().keys({
.trim()
.min(2)
.max(20)
.regex(/^[a-zA-Z0-9_-]+$/)
.regex(/^[a-zA-Z0-9_.-]+$/)
.required(),
email: Joi.string().trim().email().required(),
password: Joi.string().trim().min(8).max(128).required(),
Expand Down

0 comments on commit 1aa4b34

Please sign in to comment.