checking password length during signup

This commit is contained in:
Arjun Patel
2019-05-13 01:24:01 -07:00
parent c657b2b9c5
commit c1373db73d
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -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.
@@ -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 }
});