diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-23 04:12:31 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-23 04:12:31 +0000 |
| commit | eefeb25d3fabf377c09dd6c7282f0992eb1afea1 (patch) | |
| tree | f20e01c06ac71bf18d0ab446aa30a9d66aef52f5 /routes | |
| parent | 0ccf1dc1b80fe2dff8f98538ffac673c6b326a57 (diff) | |
| parent | 218b2c014b1ab68ee8289210820d7b6b742bceef (diff) | |
Merge branch 'master' of https://github.com/HumairAK/solutions_repo
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/user.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/routes/user.js b/routes/user.js index 39b41d2..014a7d2 100644 --- a/routes/user.js +++ b/routes/user.js @@ -49,8 +49,11 @@ router.post('/signup', loggedOut, function(req, res, next) { req.check('password', "Password should be between 6 and 12 characters.") .notEmpty().withMessage('Password required').isLength({min: 6, max: 12}); req.check('password', "The confirmation password doesn't match.").equals(req.body.confirmPassword); - req.check('phone_num', 'Please enter a valid phone number').isMobilePhone('en-CA').optional(); - // password has to be at least 4 characters long + + // phone number optional + if (req.body.phone_num){ + req.check('phone_num', 'Please enter a valid phone number').isMobilePhone('en-CA'); + } var errors = req.validationErrors(); if (errors) { @@ -66,14 +69,11 @@ router.post('/signup', loggedOut, function(req, res, next) { })(req, res); } - //res.redirect('/signup'); - }); router.post('/signin', loggedOut, function(req, res, next) { req.check('usrname', 'Username field is empty.').notEmpty(); req.check('password', "Password field is empty.").notEmpty(); - // password has to be at least 4 characters long var errors = req.validationErrors(); if (errors) { @@ -87,9 +87,9 @@ router.post('/signin', loggedOut, function(req, res, next) { failureRedirect: '/user/signin', failureFlash: true })(req, res); - } + }); module.exports = router; |
