showing ban reason on user login, closes #5002

This commit is contained in:
Julian Lam
2016-09-01 09:20:39 -04:00
parent 7cd12b0ab4
commit 1d0edee358
3 changed files with 42 additions and 2 deletions

View File

@@ -379,7 +379,14 @@ authenticationController.localLogin = function(req, username, password, next) {
return next(new Error('[[error:invalid-user-data]]'));
}
if (result.banned) {
return next(new Error('[[error:user-banned]]'));
// Retrieve ban reason and show error
return user.getLatestBanInfo(uid, function(err, banInfo) {
if (banInfo.reason) {
next(new Error('[[error:user-banned-reason, ' + banInfo.reason + ']]'));
} else {
next(new Error('[[error:user-banned]]'));
}
});
}
Password.compare(password, userData.password, next);