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 });