From afa2d9df395d9426a69dbb36ec15b4b2a8ef0521 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 9 Nov 2022 17:54:49 +0200 Subject: [PATCH] fix bad references to mongo --- src/server/Server.js | 2 +- src/server/middleware/Authenticator.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/Server.js b/src/server/Server.js index 2b484dd..186d45c 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -53,7 +53,7 @@ class Server extends EventEmitter { this.mongodb = new MongoDB(this, { options: databases.mongodb, MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_DB }); this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes }); this.authenticator = new Authenticator(this, this.app, this.userDatabase, { - mongo: this.mongodb.client, + mongo: this.mongodb, secret: SECRET, discordID: DISCORD_ID, discordScope: discord.scope, diff --git a/src/server/middleware/Authenticator.js b/src/server/middleware/Authenticator.js index 7ef7c38..2bb9923 100644 --- a/src/server/middleware/Authenticator.js +++ b/src/server/middleware/Authenticator.js @@ -35,7 +35,7 @@ class Authenticator { if (!(users instanceof AbstractUserDatabase)) Util.fatal(new Error(`Expecting user database to be an instance inheriting AbstractUserDatabase`)); this.userdb = users; - if (!mongo) Util.fatal(new Error('Missing mongo client for ')); + if (!mongo) Util.fatal(new Error('Missing mongo client for session store')); this.logger = server.createLogger(this); @@ -43,7 +43,7 @@ class Authenticator { cookie.secure = cookie.secure && process.env.NODE_ENV !== 'development'; express.use(session({ cookie, - store: MongoStore.create({ client: mongo, dbName: 'sessions' }), + store: MongoStore.create({ client: mongo.client, dbName: mongo.database, touchAfter: 600 }), secret, resave: false, saveUninitialized: true