mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
fix: don't crash if req.body.username is not string
Error: req.body.username.trim is not a function File: authenticationController.login (/usr/src/app/src/controllers/authentication.js:247:40)
This commit is contained in:
@@ -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 });
|
||||
|
||||
Reference in New Issue
Block a user