added the dot (.) username rules (#787)
This commit is contained in:
@@ -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: {
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user