This commit is contained in:
BIG2EYEZ
2024-01-28 00:09:22 +08:00
parent 6190cb63cd
commit 548064782e
5 changed files with 19 additions and 43 deletions

View File

@ -1,4 +1,4 @@
const { validationResult, body } = require('express-validator');
const {body } = require('express-validator');
const locationValidation = [
body('name').trim().isLength({ min: 1 }).withMessage('Name must not be empty').escape(),
@ -63,7 +63,7 @@ const createValidation = [
body('name').trim().isLength({ min: 1 }).withMessage('Name must not be empty').escape(),
body('username').trim().isLength({ min: 1 }).withMessage('Username must not be empty').escape(),
body('email').isEmail().withMessage('Invalid email address').normalizeEmail(),
body('password').custom((value) => {
body('password').escape().trim().custom((value) => {
if (!isStrongPassword(value)) { throw new Error('Password does not meet complexity requirements'); } return true;
}),
body('jobTitle').trim().isLength({ min: 1 }).withMessage('Job title must not be empty').escape(),
@ -102,3 +102,5 @@ module.exports = {
,sensorValidation,sensorupdateValidation,sensordeleteValidation,loginValidation,otpValidation
,createValidation
};