simpliffy login & update user count
This commit is contained in:
parent
eb9522a670
commit
aa6a7338aa
1 changed files with 5 additions and 7 deletions
|
@ -63,13 +63,9 @@ module.exports = async function(req, res, loginInfo) {
|
||||||
const newClientToken = uuid();
|
const newClientToken = uuid();
|
||||||
|
|
||||||
// Make sure user is not already connected, kick off if so.
|
// Make sure user is not already connected, kick off if so.
|
||||||
const checkForPreexistingUser = getUserByUsername(loginInfo.username);
|
const connectedUser = getUserByUsername(loginInfo.username);
|
||||||
if (checkForPreexistingUser != null && !isTourneyClient) {
|
if (connectedUser != null && !isTourneyClient && !connectedUser.isTourneyUser) {
|
||||||
for (let user of global.users.getIterableItems()) {
|
Logout(connectedUser);
|
||||||
// Log them out if they are not a tourney user
|
|
||||||
if (!user.isTourneyUser && user.uuid != newClientToken)
|
|
||||||
Logout(user);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retreive the newly created user
|
// Retreive the newly created user
|
||||||
|
@ -137,6 +133,8 @@ module.exports = async function(req, res, loginInfo) {
|
||||||
|
|
||||||
osuPacketWriter.Announce(`Welcome back ${loginInfo.username}!`);
|
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('X-Powered-By');
|
||||||
res.removeHeader('Date');
|
res.removeHeader('Date');
|
||||||
// Complete login
|
// Complete login
|
||||||
|
|
Loading…
Reference in a new issue