Skip to content

Node.js based forum software built for the modern web

fix: don't crash if req.body.username is not string

Barış Soner Uşaklı7e8ad785f49c
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index cf2d6a55a4..b97b0ca8c2 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -244,7 +244,7 @@ authenticationController.login = async (req, res, next) => {
}
const loginWith = meta.config.allowLoginWith || 'username-email';
- req.body.username = req.body.username.trim();
+ req.body.username = String(req.body.username).trim();
const errorHandler = res.locals.noScriptErrors || helpers.noScriptErrors;
try {
await plugins.hooks.fire('filter:login.check', { req: req, res: res, userData: req.body });