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)
v1.18.x
Barış Soner Uşaklı 2 years ago
parent b2bbc207a9
commit 1e541de7db

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

Loading…
Cancel
Save