Merge pull request 'feature/RVRNEXT-33-no-permanent-session' (!45) from feature/RVRNEXT-33-no-permanent-session into master
All checks were successful
rvr-nextgen/pipeline/head This commit looks good
All checks were successful
rvr-nextgen/pipeline/head This commit looks good
Reviewed-on: #45
This commit is contained in:
commit
8d495c9f37
@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"esoko/soko-web": "0.8",
|
"esoko/soko-web": "0.10",
|
||||||
"firebase/php-jwt": "^6.4"
|
"firebase/php-jwt": "^6.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
8
composer.lock
generated
8
composer.lock
generated
@ -4,15 +4,15 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a89a42e04596ab159fc41abbd9390068",
|
"content-hash": "607b383c44826c6307dd79b0362ca320",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "esoko/soko-web",
|
"name": "esoko/soko-web",
|
||||||
"version": "v0.8",
|
"version": "0.10",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
||||||
"reference": "219b42f995b8e34432da4dde77e53e24b75d78dd"
|
"reference": "fd286c9cffadc4a26609bfa00944f8014a2f3f59"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"phpmailer/phpmailer": "^6.8",
|
"phpmailer/phpmailer": "^6.8",
|
||||||
@ -33,7 +33,7 @@
|
|||||||
"GNU GPL 3.0"
|
"GNU GPL 3.0"
|
||||||
],
|
],
|
||||||
"description": "Lightweight web framework",
|
"description": "Lightweight web framework",
|
||||||
"time": "2023-05-01T17:08:22+00:00"
|
"time": "2023-05-02T10:55:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "firebase/php-jwt",
|
"name": "firebase/php-jwt",
|
||||||
|
21
web.php
21
web.php
@ -4,6 +4,7 @@ use SokoWeb\Response\HttpResponse;
|
|||||||
use SokoWeb\Routing\RouteCollection;
|
use SokoWeb\Routing\RouteCollection;
|
||||||
use SokoWeb\Session\DatabaseSessionHandler;
|
use SokoWeb\Session\DatabaseSessionHandler;
|
||||||
use SokoWeb\Request\Request;
|
use SokoWeb\Request\Request;
|
||||||
|
use SokoWeb\Request\Session;
|
||||||
use RVR\Controller\HomeController;
|
use RVR\Controller\HomeController;
|
||||||
use RVR\Controller\LoginController;
|
use RVR\Controller\LoginController;
|
||||||
use RVR\Controller\OAuthAuthController;
|
use RVR\Controller\OAuthAuthController;
|
||||||
@ -88,33 +89,27 @@ 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_set_save_handler(Container::$sessionHandler, true);
|
||||||
session_start([
|
session_start([
|
||||||
'gc_probability' => 0, // old sessions are deleted by MaintainDatabaseCommand
|
'gc_probability' => 0, // old sessions are deleted by MaintainDatabaseCommand
|
||||||
'cookie_lifetime' => 604800,
|
'cookie_lifetime' => 0,
|
||||||
'cookie_path' => '/',
|
'cookie_path' => '/',
|
||||||
'cookie_httponly' => true,
|
'cookie_httponly' => true,
|
||||||
'cookie_samesite' => 'Lax'
|
'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(
|
Container::$request = new Request(
|
||||||
$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
|
$_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'],
|
||||||
$_GET,
|
$_GET,
|
||||||
$_POST,
|
$_POST,
|
||||||
getallheaders(),
|
getallheaders(),
|
||||||
$_SESSION,
|
new Session($_SESSION),
|
||||||
new UserRepository()
|
new UserRepository()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user