From aa6a7338aad54b3ca2f3be0b40bd11ee708d9269 Mon Sep 17 00:00:00 2001 From: Holly Date: Fri, 26 Aug 2022 12:51:08 +0100 Subject: [PATCH] simpliffy login & update user count --- server/loginHandler.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/loginHandler.js b/server/loginHandler.js index 40bf920..f1fec67 100644 --- a/server/loginHandler.js +++ b/server/loginHandler.js @@ -63,13 +63,9 @@ module.exports = async function(req, res, loginInfo) { const newClientToken = uuid(); // Make sure user is not already connected, kick off if so. - const checkForPreexistingUser = getUserByUsername(loginInfo.username); - if (checkForPreexistingUser != null && !isTourneyClient) { - for (let user of global.users.getIterableItems()) { - // Log them out if they are not a tourney user - if (!user.isTourneyUser && user.uuid != newClientToken) - Logout(user); - } + const connectedUser = getUserByUsername(loginInfo.username); + if (connectedUser != null && !isTourneyClient && !connectedUser.isTourneyUser) { + Logout(connectedUser); } // Retreive the newly created user @@ -137,6 +133,8 @@ module.exports = async function(req, res, loginInfo) { osuPacketWriter.Announce(`Welcome back ${loginInfo.username}!`); + global.DatabaseHelper.query("UPDATE osu_info SET value = ? WHERE name = 'online_now'", [global.users.getLength() - 1]); + res.removeHeader('X-Powered-By'); res.removeHeader('Date'); // Complete login