Skip to content

Node.js based forum software built for the modern web

fix: improper override of req.body.username in login logic

Julian Lam741992204092
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js
index ed25277fa9..53de38b08c 100644
--- a/src/controllers/authentication.js
+++ b/src/controllers/authentication.js
@@ -234,7 +234,10 @@ authenticationController.login = async (req, res, next) => {
user.getUsernameByEmail(req.body.username, next);
},
function (username, next) {
- req.body.username = username || req.body.username;
+ if (username !== '[[global:guest]]') {
+ req.body.username = username;
+ }
+
(res.locals.continueLogin || continueLogin)(strategy, req, res, next);
},
], next);