mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-02 12:05:57 +01:00
fixes #5226
This commit is contained in:
@@ -387,7 +387,11 @@ authenticationController.localLogin = function (req, username, password, next) {
|
|||||||
// Retrieve ban reason and show error
|
// Retrieve ban reason and show error
|
||||||
return user.getLatestBanInfo(uid, function (err, banInfo) {
|
return user.getLatestBanInfo(uid, function (err, banInfo) {
|
||||||
if (err) {
|
if (err) {
|
||||||
next(err);
|
if (err.message === 'no-ban-info') {
|
||||||
|
next(new Error('[[error:user-banned]]'));
|
||||||
|
} else {
|
||||||
|
next(err);
|
||||||
|
}
|
||||||
} else if (banInfo.reason) {
|
} else if (banInfo.reason) {
|
||||||
next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]'));
|
next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]'));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ module.exports = function (User) {
|
|||||||
async.waterfall([
|
async.waterfall([
|
||||||
async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0, 0),
|
async.apply(db.getSortedSetRevRangeWithScores, 'uid:' + uid + ':bans', 0, 0),
|
||||||
function (record, next) {
|
function (record, next) {
|
||||||
|
if (!record.length) {
|
||||||
|
return next(new Error('no-ban-info'));
|
||||||
|
}
|
||||||
|
|
||||||
timestamp = record[0].score;
|
timestamp = record[0].score;
|
||||||
expiry = record[0].value;
|
expiry = record[0].value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user