From b8eb19b9917cd8d91535b41df81bd912fbff76b3 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Tue, 23 Feb 2016 13:57:00 -0500 Subject: [PATCH] closes #3993 --- src/user/password.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/user/password.js b/src/user/password.js index e116edb867..e60ae9b753 100644 --- a/src/user/password.js +++ b/src/user/password.js @@ -19,17 +19,21 @@ module.exports = function(User) { User.isPasswordCorrect = function(uid, password, callback) { password = password || ''; async.waterfall([ - function (next) { - User.isPasswordValid(password, next); - }, function (next) { db.getObjectField('user:' + uid, 'password', next); }, function (hashedPassword, next) { if (!hashedPassword) { - return callback(); + return callback(null, true); } - Password.compare(password, hashedPassword, next); + + User.isPasswordValid(password, function(err) { + if (err) { + return next(err); + } + + Password.compare(password, hashedPassword, next); + }); } ], callback); };