Skip to content

Commit

Permalink
feat:validation fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
AwaleRohin committed May 23, 2019
1 parent 20b321f commit e5c092a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions middleware/signupValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ exports.validate = (method) => {
return true;
}),
body('password', 'Invalid Password').matches('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})'),
body('password', 'Invalid Password').custom((value, { req }) => {
if (body('password').contains(req.body.first_name, req.body.last_name,req.body.email.substr(0,req.body.email.indexOf('@')))) {
throw new Error('Password should not contains name/email');
}
return true;
}),
// body('password', 'Invalid Password').custom((value, { req }) => {
// if (body('password').contains(req.body.first_name) ){
// throw new Error('Password should not contains name/email');
// }
// return true;
// }),
body('user_role', 'Invalid user role').isBoolean()
]
}
Expand Down

0 comments on commit e5c092a

Please sign in to comment.