diff --git a/config/env/default.js b/config/env/default.js index 105aa154b6..cc09ea42f6 100644 --- a/config/env/default.js +++ b/config/env/default.js @@ -10,6 +10,8 @@ module.exports = { port: process.env.PORT || 3000, templateEngine: 'swig', // Session details + // session expiration is set by default to 24 hours + sessionExpiration: 24 * (60 * 1000), // sessionSecret should be changed for security measures and concerns sessionSecret: 'MEAN', // sessionKey is set to the generic sessionId key used by PHP applications diff --git a/config/lib/express.js b/config/lib/express.js index ca4313eb2d..9e2bfe03e9 100644 --- a/config/lib/express.js +++ b/config/lib/express.js @@ -115,6 +115,9 @@ module.exports.initSession = function (app, db) { saveUninitialized: true, resave: true, secret: config.sessionSecret, + cookie: { + maxAge: config.sessionExpiration + }, key: config.sessionKey, store: new MongoStore({ mongooseConnection: db.connection,