From 08920d5b10d96c41841bad0135dfd37e2ead7929 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Thu, 29 Jun 2017 15:32:35 +0200 Subject: [PATCH] Allow to set `system.session.timeout` to 0 to clear session on browser close (#1538) * Allow to set expire to 0 to clear session on browser close * Changelog --- CHANGELOG.md | 2 ++ system/src/Grav/Common/Session.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b6f0e3c3..c3db40adf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # v1.3.0-rc.5 ## mm/dd/2017 +1. [](#new) + * Setting `system.session.timeout` to 0 clears the session when the browser session ends [#1538](https://github.com/getgrav/grav/pull/1538) 1. [](#bugfix) * Fixed global media files disappearing after a reload [#1545](https://github.com/getgrav/grav/issues/1545) * Set folder name as required during validation [grav-plugin-admin#1146](https://github.com/getgrav/grav-plugin-admin/issues/1146) diff --git a/system/src/Grav/Common/Session.php b/system/src/Grav/Common/Session.php index aeaf881fc..67aaab5ae 100644 --- a/system/src/Grav/Common/Session.php +++ b/system/src/Grav/Common/Session.php @@ -84,7 +84,7 @@ class Session extends BaseSession } $this->setName($session_name); $this->start(); - setcookie(session_name(), session_id(), time() + $session_timeout, $session_path, $domain, $secure, $httponly); + setcookie(session_name(), session_id(), $session_timeout ? time() + $session_timeout : 0, $session_path, $domain, $secure, $httponly); } }