Skip to content

Node.js based forum software built for the modern web

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

Julian Lamc3df68f2ed34
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index fef6f088b6..d5a0965d7b 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -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([