add validation new_password
This commit is contained in:
@@ -32,6 +32,19 @@ const loginSchema = Joi.object({
|
|||||||
captcha: Joi.string().required(),
|
captcha: Joi.string().required(),
|
||||||
captchaText: Joi.string().required()
|
captchaText: Joi.string().required()
|
||||||
});
|
});
|
||||||
|
const newPasswordSchema = Joi.object({
|
||||||
|
new_password: Joi.string()
|
||||||
|
.min(8)
|
||||||
|
.pattern(/[A-Z]/, 'uppercase letter')
|
||||||
|
.pattern(/[a-z]/, 'lowercase letter')
|
||||||
|
.pattern(/\d/, 'number')
|
||||||
|
.pattern(/[!@#$%^&*(),.?":{}|<>]/, 'special character')
|
||||||
|
.required()
|
||||||
|
.messages({
|
||||||
|
'string.min': 'Password must be at least 8 characters long',
|
||||||
|
'string.pattern.name': 'Password must contain at least one {#name}'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
// ========================
|
// ========================
|
||||||
// Device Validation
|
// Device Validation
|
||||||
@@ -94,6 +107,7 @@ const userSchema = Joi.object({
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
registerSchema,
|
registerSchema,
|
||||||
loginSchema,
|
loginSchema,
|
||||||
|
newPasswordSchema,
|
||||||
deviceSchema,
|
deviceSchema,
|
||||||
deviceUpdateSchema,
|
deviceUpdateSchema,
|
||||||
userSchema,
|
userSchema,
|
||||||
|
|||||||
Reference in New Issue
Block a user