Skip to content

Node.js based forum software built for the modern web

add blacklist test to onSuccessfulLogin as well

Julian Lam81cf8f77d3d6
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) {