mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-04-09 14:09:32 +02:00
fix: #14116, don't return ban reason if login credentials are incorrect
This commit is contained in:
@@ -409,21 +409,20 @@ authenticationController.localLogin = async function (req, username, password, n
|
||||
|
||||
userData.isAdminOrGlobalMod = isAdminOrGlobalMod;
|
||||
|
||||
if (!canLoginIfBanned) {
|
||||
return next(await getBanError(uid));
|
||||
}
|
||||
|
||||
// Doing this after the ban check, because user's privileges might change after a ban expires
|
||||
const hasLoginPrivilege = await privileges.global.can('local:login', uid);
|
||||
if (parseInt(uid, 10) && !hasLoginPrivilege) {
|
||||
return next(new Error('[[error:local-login-disabled]]'));
|
||||
}
|
||||
|
||||
try {
|
||||
const passwordMatch = await user.isPasswordCorrect(uid, password, req.ip);
|
||||
if (!passwordMatch) {
|
||||
return next(new Error('[[error:invalid-login-credentials]]'));
|
||||
}
|
||||
if (!canLoginIfBanned) {
|
||||
return next(await getBanError(uid));
|
||||
}
|
||||
|
||||
// Doing this after the ban check, because user's privileges might change after a ban expires
|
||||
const hasLoginPrivilege = await privileges.global.can('local:login', uid);
|
||||
if (parseInt(uid, 10) && !hasLoginPrivilege) {
|
||||
return next(new Error('[[error:local-login-disabled]]'));
|
||||
}
|
||||
} catch (e) {
|
||||
if (req.loggedIn) {
|
||||
await logoutAsync(req);
|
||||
|
||||
Reference in New Issue
Block a user