fix: don\'t begin processing local login if the passed-in username isn't even valid

This commit is contained in:
Julian Lam
2025-09-30 11:05:42 -04:00
parent 9a596d67f3
commit c3df68f2ed

View File

@@ -420,6 +420,10 @@ authenticationController.localLogin = async function (req, username, password, n
}
const userslug = slugify(username);
if (!utils.isUserNameValid(username) || !userslug) {
return next(new Error('[[error:invalid-username]]'));
}
const uid = await user.getUidByUserslug(userslug);
try {
const [userData, isAdminOrGlobalMod, canLoginIfBanned] = await Promise.all([