From 4adb93c1a680bff891c7acf6e9a56d778a459cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Guillot?= Date: Mon, 10 Apr 2023 21:11:09 -0700 Subject: [PATCH] Use SESSION_DURATION option to define the session lifetime stored in the database The option `SESSION_DURATION` is used to define the cookie lifetime. With this change, Kanboard will try to use first `SESSION_DURATION` instead of the default `session.gc_maxlifetime` value. Fixes #4340 --- app/Core/Session/SessionHandler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Core/Session/SessionHandler.php b/app/Core/Session/SessionHandler.php index 66c4aa0cb..5e736c299 100644 --- a/app/Core/Session/SessionHandler.php +++ b/app/Core/Session/SessionHandler.php @@ -58,7 +58,11 @@ class SessionHandler implements SessionHandlerInterface #[\ReturnTypeWillChange] public function write($sessionID, $data) { - $lifetime = time() + (ini_get('session.gc_maxlifetime') ?: 1440); + if (SESSION_DURATION > 0) { + $lifetime = time() + SESSION_DURATION; + } else { + $lifetime = time() + (ini_get('session.gc_maxlifetime') ?: 1440); + } $this->db->startTransaction();