From cafbdfd83e0b8cd50f956ea2e9fed94dc49b57dd Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 23 Nov 2016 11:45:29 -0500 Subject: [PATCH] fixes #5226 --- src/controllers/authentication.js | 6 +++++- src/user/info.js | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 1d45b2cbd5..4612226d59 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -387,7 +387,11 @@ authenticationController.localLogin = function (req, username, password, next) { // Retrieve ban reason and show error return user.getLatestBanInfo(uid, function (err, banInfo) { if (err) { - next(err); + if (err.message === 'no-ban-info') { + next(new Error('[[error:user-banned]]')); + } else { + next(err); + } } else if (banInfo.reason) { next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]')); } else { diff --git a/src/user/info.js b/src/user/info.js index 1ed9cdef14..296dd9a723 100644 --- a/src/user/info.js +++ b/src/user/info.js @@ -16,6 +16,10 @@ module.exports = function (User) { async.waterfall([ async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0, 0), function (record, next) { + if (!record.length) { + return next(new Error('no-ban-info')); + } + timestamp = record[0].score; expiry = record[0].value;