v1.18.x
Julian Lam
parent 4ff71f6b0b
commit cafbdfd83e

@ -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 {

@ -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;

Loading…
Cancel
Save