From 1aa4b34dc6c914c2992bb50d39c9b7363f144cf4 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+Berry-13@users.noreply.github.com> Date: Fri, 11 Aug 2023 19:02:52 +0200 Subject: [PATCH] added the dot (.) username rules (#787) --- api/models/User.js | 4 ++-- api/strategies/validators.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/models/User.js b/api/models/User.js index e6ea9ce75ca..f7d07ade228 100644 --- a/api/models/User.js +++ b/api/models/User.js @@ -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), }; diff --git a/api/strategies/validators.js b/api/strategies/validators.js index 7905007838d..f105cae9b4a 100644 --- a/api/strategies/validators.js +++ b/api/strategies/validators.js @@ -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(),