Use userid instead of username when username is null in authlog, #5870

Ylian Saint-Hilaire committed Mar 3, 2024 at 12:21 UTC 9e9cd821bf58289f437b6786b93d67858cb4638a
1 file changed +1 -1
webserver.js
+1 -1
@@ -1411,7 +1411,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
1411 req.session.userid = userid;
1412 req.session.ip = req.clientIp;
1413 setSessionRandom(req);
1414 - obj.parent.authLog('https', 'Accepted password for ' + xusername + ' from ' + req.clientIp + ' port ' + req.connection.remotePort, { useragent: req.headers['user-agent'], sessionid: req.session.x });
1414 + obj.parent.authLog('https', 'Accepted password for ' + (xusername ? xusername : userid) + ' from ' + req.clientIp + ' port ' + req.connection.remotePort, { useragent: req.headers['user-agent'], sessionid: req.session.x });
1415
1416 // If a login token was used, add this information and expire time to the session.
1417 if ((loginOptions != null) && (loginOptions.tokenName != null) && (loginOptions.tokenUser != null)) {