From 3f6e2404010c159c56fe8d002afecf176fac3fa9 Mon Sep 17 00:00:00 2001 From: Charley Peng Date: Thu, 1 Mar 2007 16:53:59 +1100 Subject: [PATCH 1/2] adding callback on error --- services/web/app/coffee/controllers/UserController.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/web/app/coffee/controllers/UserController.coffee b/services/web/app/coffee/controllers/UserController.coffee index 92e8fe0d2d..b2d5e97ceb 100644 --- a/services/web/app/coffee/controllers/UserController.coffee +++ b/services/web/app/coffee/controllers/UserController.coffee @@ -170,6 +170,7 @@ module.exports = metrics.inc "user.password-change" oldPass = req.body.currentPassword AuthenticationManager.authenticate _id: req.session.user._id, oldPass, (err, user)-> + return callback(error) if error? if(user) logger.log user: req.session.user, "changing password" newPassword1 = req.body.newPassword1 @@ -198,17 +199,20 @@ module.exports = redirectUserToDropboxAuth: (req, res)-> user_id = req.session.user._id dropboxHandler.getDropboxRegisterUrl user_id, (err, url)-> + return callback(error) if error? logger.log url:url, "redirecting user for dropbox auth" res.redirect url completeDropboxRegistration: (req, res)-> user_id = req.session.user._id dropboxHandler.completeRegistration user_id, (err, success)-> + return callback(error) if error? res.redirect('/user/settings#dropboxSettings') unlinkDropbox: (req, res)-> user_id = req.session.user._id dropboxHandler.unlinkAccount user_id, (err, success)-> + return callback(error) if error? res.redirect('/user/settings#dropboxSettings') deleteUser: (req, res)-> From fa80b0c3d2d6810227372a20b87af27a5cbf34ae Mon Sep 17 00:00:00 2001 From: Charley Peng Date: Wed, 26 Feb 2014 08:58:51 +1100 Subject: [PATCH 2/2] fixing incorrectly written variable --- services/web/app/coffee/controllers/UserController.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/app/coffee/controllers/UserController.coffee b/services/web/app/coffee/controllers/UserController.coffee index b2d5e97ceb..2f2979fa59 100644 --- a/services/web/app/coffee/controllers/UserController.coffee +++ b/services/web/app/coffee/controllers/UserController.coffee @@ -170,7 +170,7 @@ module.exports = metrics.inc "user.password-change" oldPass = req.body.currentPassword AuthenticationManager.authenticate _id: req.session.user._id, oldPass, (err, user)-> - return callback(error) if error? + return callback(err) if err? if(user) logger.log user: req.session.user, "changing password" newPassword1 = req.body.newPassword1 @@ -199,20 +199,20 @@ module.exports = redirectUserToDropboxAuth: (req, res)-> user_id = req.session.user._id dropboxHandler.getDropboxRegisterUrl user_id, (err, url)-> - return callback(error) if error? + return callback(err) if err? logger.log url:url, "redirecting user for dropbox auth" res.redirect url completeDropboxRegistration: (req, res)-> user_id = req.session.user._id dropboxHandler.completeRegistration user_id, (err, success)-> - return callback(error) if error? + return callback(err) if err? res.redirect('/user/settings#dropboxSettings') unlinkDropbox: (req, res)-> user_id = req.session.user._id dropboxHandler.unlinkAccount user_id, (err, success)-> - return callback(error) if error? + return callback(err) if err? res.redirect('/user/settings#dropboxSettings') deleteUser: (req, res)->