From c1373db73de977dda3bee619e4c01af8b14bb172 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Mon, 13 May 2019 01:24:01 -0700 Subject: [PATCH] checking password length during signup --- app/controllers/donor.controller.js | 2 ++ app/controllers/organization.controller.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/controllers/donor.controller.js b/app/controllers/donor.controller.js index 92cd57d..8088e08 100644 --- a/app/controllers/donor.controller.js +++ b/app/controllers/donor.controller.js @@ -17,6 +17,8 @@ exports.createDonor = (req, res, next) => { if (donors.length >= 1) { return next(errorMaker(409, `Email Exists: ${req.body.email}`)); } else { + if (req.body.password.length < 6) + return next(errorMaker(400, 'Password requirements not met!')); // hash and store bcrypt.hash(req.body.password, null, null, function(error, hash) { // Store hash in your password DB. diff --git a/app/controllers/organization.controller.js b/app/controllers/organization.controller.js index 9c3123c..f476cf9 100644 --- a/app/controllers/organization.controller.js +++ b/app/controllers/organization.controller.js @@ -107,6 +107,9 @@ exports.createOrganization = async (req, res, next) => { try { transaction = await db.sequelize.transaction(); + if (password.length < 6) + return next(errorMaker(400, 'Password requirements not met!')); + const orgs = await Organization.findAll({ where: { primary_contact_email } });