From 0c102da1d70504f25962a34c6ba568ddd1fe4032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Tue, 2 May 2023 12:09:31 +0200 Subject: [PATCH 1/3] RVRNEXT-33 update soko-web to 0.10 --- composer.json | 2 +- composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 45d6329..bfa6365 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "esoko/soko-web": "0.8", + "esoko/soko-web": "0.10", "firebase/php-jwt": "^6.4" }, "require-dev": { diff --git a/composer.lock b/composer.lock index e3bd9cf..d8aecb4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a89a42e04596ab159fc41abbd9390068", + "content-hash": "607b383c44826c6307dd79b0362ca320", "packages": [ { "name": "esoko/soko-web", - "version": "v0.8", + "version": "0.10", "source": { "type": "git", "url": "https://git.esoko.eu/esoko/soko-web.git", - "reference": "219b42f995b8e34432da4dde77e53e24b75d78dd" + "reference": "fd286c9cffadc4a26609bfa00944f8014a2f3f59" }, "require": { "phpmailer/phpmailer": "^6.8", @@ -33,7 +33,7 @@ "GNU GPL 3.0" ], "description": "Lightweight web framework", - "time": "2023-05-01T17:08:22+00:00" + "time": "2023-05-02T10:55:47+00:00" }, { "name": "firebase/php-jwt", From 97e04d785c57226c403cfee24c93a8b1ade6bdec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Tue, 2 May 2023 12:10:29 +0200 Subject: [PATCH 2/3] RVRNEXT-33 adapt to new soko-web interfaces --- web.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web.php b/web.php index 125deca..b026a37 100644 --- a/web.php +++ b/web.php @@ -4,6 +4,7 @@ use SokoWeb\Response\HttpResponse; use SokoWeb\Routing\RouteCollection; use SokoWeb\Session\DatabaseSessionHandler; use SokoWeb\Request\Request; +use SokoWeb\Request\Session; use RVR\Controller\HomeController; use RVR\Controller\LoginController; use RVR\Controller\OAuthAuthController; @@ -88,7 +89,11 @@ Container::$routeCollection->group('communities', function (RouteCollection $rou }); }); -Container::$sessionHandler = new DatabaseSessionHandler(Container::$dbConnection); +Container::$sessionHandler = new DatabaseSessionHandler( + Container::$dbConnection, + 'sessions', + new DateTime('-7 days') +); session_set_save_handler(Container::$sessionHandler, true); session_start([ @@ -114,7 +119,7 @@ Container::$request = new Request( $_GET, $_POST, getallheaders(), - $_SESSION, + new Session($_SESSION), new UserRepository() ); From cc8f1e1ace153edcf91b0752e999a2a20382a153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Tue, 2 May 2023 12:55:19 +0200 Subject: [PATCH 3/3] RVRNEXT-33 session should be valid for a session --- web.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/web.php b/web.php index b026a37..c0d3593 100644 --- a/web.php +++ b/web.php @@ -98,22 +98,12 @@ Container::$sessionHandler = new DatabaseSessionHandler( session_set_save_handler(Container::$sessionHandler, true); session_start([ 'gc_probability' => 0, // old sessions are deleted by MaintainDatabaseCommand - 'cookie_lifetime' => 604800, + 'cookie_lifetime' => 0, 'cookie_path' => '/', 'cookie_httponly' => true, 'cookie_samesite' => 'Lax' ]); -if (isset($_COOKIE[session_name()])) { - // extend session cookie lifetime is cookie already exists - setcookie(session_name(), session_id(), [ - 'expires' => time() + 604800, - 'path' => '/', - 'httponly' => true, - 'samesite' => 'Lax' - ]); -} - Container::$request = new Request( $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'], $_GET,