From: Vincent Vanwaelscappel Date: Wed, 8 Jan 2020 18:38:17 +0000 (+0100) Subject: wip #3316 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ab8d3618378001335b4052d6468170c031fe6d3f;p=cubist_cms-back.git wip #3316 @0.5 --- diff --git a/composer.json b/composer.json index 37c729a..0d10c53 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,11 @@ }, "laravel": { "providers": [ - "Cubist\\Backpack\\CubistBackpackServiceProvider" + "Cubist\\Backpack\\CubistBackpackServiceProvider", + "Cubist\\Backpack\\CookieServiceProvider" + ], + "dont-discover": [ + "Illuminate\\Cookie\\CookieServiceProvider" ], "aliases": { "CubistMenu": "Cubist\\Backpack\\app\\Magic\\Menu\\Facade", diff --git a/src/CookieServiceProvider.php b/src/CookieServiceProvider.php new file mode 100644 index 0000000..2c6c1ad --- /dev/null +++ b/src/CookieServiceProvider.php @@ -0,0 +1,31 @@ +app->singleton('cookie', function ($app) { + $config = $app->make('config')->get('session'); + + $domains = explode(',', $config['domain']); + if (count($domains) === 1) { + $domain = $domains[0]; + } else { + foreach ($domains as $domain) { + if (stripos($_SERVER['HTTP_HOST'], $domain) !== false) { + break; + } + } + } + + return (new CookieJar)->setDefaultPathAndDomain( + $config['path'], $domain, $config['secure'], $config['same_site'] ?? null + ); + }); + } +} diff --git a/src/app/Middleware/StartSession.php b/src/app/Middleware/StartSession.php new file mode 100644 index 0000000..c60d888 --- /dev/null +++ b/src/app/Middleware/StartSession.php @@ -0,0 +1,11 @@ +