checking password length during signup
This commit is contained in:
@@ -17,6 +17,8 @@ exports.createDonor = (req, res, next) => {
|
|||||||
if (donors.length >= 1) {
|
if (donors.length >= 1) {
|
||||||
return next(errorMaker(409, `Email Exists: ${req.body.email}`));
|
return next(errorMaker(409, `Email Exists: ${req.body.email}`));
|
||||||
} else {
|
} else {
|
||||||
|
if (req.body.password.length < 6)
|
||||||
|
return next(errorMaker(400, 'Password requirements not met!'));
|
||||||
// hash and store
|
// hash and store
|
||||||
bcrypt.hash(req.body.password, null, null, function(error, hash) {
|
bcrypt.hash(req.body.password, null, null, function(error, hash) {
|
||||||
// Store hash in your password DB.
|
// Store hash in your password DB.
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ exports.createOrganization = async (req, res, next) => {
|
|||||||
try {
|
try {
|
||||||
transaction = await db.sequelize.transaction();
|
transaction = await db.sequelize.transaction();
|
||||||
|
|
||||||
|
if (password.length < 6)
|
||||||
|
return next(errorMaker(400, 'Password requirements not met!'));
|
||||||
|
|
||||||
const orgs = await Organization.findAll({
|
const orgs = await Organization.findAll({
|
||||||
where: { primary_contact_email }
|
where: { primary_contact_email }
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user