From 81cf8f77d3d646108e1e084656c15a7bea5cb1c6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 23 Aug 2017 12:13:52 -0400 Subject: [PATCH] add blacklist test to onSuccessfulLogin as well --- src/controllers/authentication.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 5309bdc380..5e4a3486b8 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -274,7 +274,6 @@ authenticationController.doLogin = function (req, uid, callback) { }; authenticationController.onSuccessfulLogin = function (req, uid, callback) { - callback = callback || function () {}; var uuid = utils.generateUUID(); req.session.meta = {}; @@ -294,6 +293,7 @@ authenticationController.onSuccessfulLogin = function (req, uid, callback) { }); async.waterfall([ + async.apply(meta.blacklist.test, req.ip), function (next) { async.parallel([ function (next) { @@ -316,7 +316,17 @@ authenticationController.onSuccessfulLogin = function (req, uid, callback) { plugins.fireHook('action:user.loggedIn', { uid: uid, req: req }); next(); }, - ], callback); + ], function (err) { + if (err) { + req.session.destroy(); + } + + if (typeof callback === 'function') { + callback(err); + } else { + return false; + } + }); }; authenticationController.localLogin = function (req, username, password, next) {