From 3438e19cea85ae530afd1535fe0384a8beebec90 Mon Sep 17 00:00:00 2001 From: nanalelfe Date: Fri, 22 Jul 2016 20:30:27 -0400 Subject: Fixed minor issue --- routes/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'routes') diff --git a/routes/user.js b/routes/user.js index 698c4f8..39b41d2 100644 --- a/routes/user.js +++ b/routes/user.js @@ -56,7 +56,7 @@ router.post('/signup', loggedOut, function(req, res, next) { if (errors) { req.session.errors = errors; req.session.success = false; - res.redirect('/signup'); + res.redirect('/user/signup'); } else { console.log("GOT SUCCESS"); passport.authenticate('local_signup', { -- cgit v1.2.3 From 5240b6ff1bd881b482caba3dc3c1b30597fb1353 Mon Sep 17 00:00:00 2001 From: nanalelfe Date: Fri, 22 Jul 2016 22:12:02 -0400 Subject: Fixed session storage. Fixed optional phone number in signup --- routes/user.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'routes') diff --git a/routes/user.js b/routes/user.js index 39b41d2..840930a 100644 --- a/routes/user.js +++ b/routes/user.js @@ -49,7 +49,9 @@ 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(); + if (req.body.phone_num){ + req.check('phone_num', 'Please enter a valid phone number').isMobilePhone('en-CA'); + } // password has to be at least 4 characters long var errors = req.validationErrors(); -- cgit v1.2.3 From 218b2c014b1ab68ee8289210820d7b6b742bceef Mon Sep 17 00:00:00 2001 From: nanalelfe Date: Fri, 22 Jul 2016 23:58:19 -0400 Subject: Populated user info into user_profile.hbs --- routes/user.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'routes') diff --git a/routes/user.js b/routes/user.js index 840930a..014a7d2 100644 --- a/routes/user.js +++ b/routes/user.js @@ -49,10 +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); + + // phone number optional if (req.body.phone_num){ req.check('phone_num', 'Please enter a valid phone number').isMobilePhone('en-CA'); } - // password has to be at least 4 characters long var errors = req.validationErrors(); if (errors) { @@ -68,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) { @@ -89,9 +87,9 @@ router.post('/signin', loggedOut, function(req, res, next) { failureRedirect: '/user/signin', failureFlash: true })(req, res); - } + }); module.exports = router; -- cgit v1.2.3