clean up
This commit is contained in:
@ -13,4 +13,6 @@ let transporter = nodemailer.createTransport({
|
||||
pass: process.env.epass
|
||||
},
|
||||
});
|
||||
module.exports = { transporter };
|
||||
module.exports = { transporter };
|
||||
|
||||
|
||||
|
@ -39,4 +39,8 @@ const sendOTPByEmail = async (email, otp) => {
|
||||
module.exports = {
|
||||
generateOTP,
|
||||
sendOTPByEmail
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
@ -4,6 +4,10 @@ const limiter = rateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: 5, // limit each IP to 5 requests per windowMs
|
||||
message: 'Too many login attempts from this IP, please try again later.',
|
||||
standardHeaders: "draft-7", // draft-6: `RateLimit-*` headers; draft-7: combined `RateLimit` header
|
||||
legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
|
||||
});
|
||||
|
||||
module.exports = limiter;
|
||||
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user