From 4f8815eb78a45fe9d26684398baff50fc90c6752 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 26 Jul 2018 16:38:36 -0400 Subject: [PATCH] closes #6646 --- src/controllers/authentication.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 643b898843..d1a4ad9bca 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -12,7 +12,6 @@ var meta = require('../meta'); var user = require('../user'); var plugins = require('../plugins'); var utils = require('../utils'); -var Password = require('../password'); var translator = require('../translator'); var helpers = require('./helpers'); @@ -398,9 +397,6 @@ authenticationController.localLogin = function (req, username, password, next) { uid = _uid; async.parallel({ - userData: function (next) { - db.getObjectFields('user:' + uid, ['password', 'passwordExpiry'], next); - }, isAdminOrGlobalMod: function (next) { user.isAdminOrGlobalMod(uid, next); }, @@ -410,9 +406,10 @@ authenticationController.localLogin = function (req, username, password, next) { }, next); }, function (result, next) { - userData = result.userData; - userData.uid = uid; - userData.isAdminOrGlobalMod = result.isAdminOrGlobalMod; + userData = { + uid: uid, + isAdminOrGlobalMod: result.isAdminOrGlobalMod, + }; if (!result.isAdminOrGlobalMod && parseInt(meta.config.allowLocalLogin, 10) === 0) { return next(new Error('[[error:local-login-disabled]]')); @@ -425,7 +422,7 @@ authenticationController.localLogin = function (req, username, password, next) { user.auth.logAttempt(uid, req.ip, next); }, function (next) { - Password.compare(password, userData.password, next); + user.isPasswordCorrect(uid, password, next); }, function (passwordMatch, next) { if (!passwordMatch) {