Disable rolling sessions in web-admin (#9307)

GitOrigin-RevId: 7f098d5222d21187f219c0906757b913890e85e7
This commit is contained in:
Miguel Serrano 2022-09-01 09:20:16 +02:00 committed by Copybot
parent c908c0c07d
commit e414c65028
2 changed files with 19 additions and 16 deletions

View file

@ -161,7 +161,7 @@ webRouter.use(
},
store: sessionStore,
key: Settings.cookieName,
rolling: true,
rolling: Settings.cookieRollingSession === true,
})
)
if (Features.hasFeature('saas')) {
@ -203,8 +203,9 @@ webRouter.use(webRouter.csrf.middleware)
webRouter.use(translations.i18nMiddleware)
webRouter.use(translations.setLangBasedOnDomainMiddleware)
// Measure expiry from last request, not last login
webRouter.use(function (req, res, next) {
if (Settings.cookieRollingSession) {
// Measure expiry from last request, not last login
webRouter.use(function (req, res, next) {
if (!req.session.noSessionCallback) {
req.session.touch()
if (SessionManager.isUserLoggedIn(req.session)) {
@ -219,7 +220,8 @@ webRouter.use(function (req, res, next) {
}
}
next()
})
})
}
webRouter.use(ReferalConnect.use)
expressLocals(webRouter, privateApiRouter, publicApiRouter)

View file

@ -264,6 +264,7 @@ module.exports = {
// replace subdomain with dot to have them accessible on all subdomains
cookieDomain: process.env.COOKIE_DOMAIN,
cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
cookieRollingSession: true,
// this is only used if cookies are used for clsi backend
// clsiCookieKey: "clsiserver"