From 980a687322257c4589e574b661227085eb5b2e47 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 2 Jun 2021 10:02:05 +1000 Subject: [PATCH] Fixes for CORS --- app/Http/Kernel.php | 9 +++++++ app/Http/Livewire/BillingPortalPurchase.php | 2 +- app/Http/Middleware/VerifyCsrfToken.php | 2 +- composer.json | 2 +- composer.lock | 29 ++++++++++----------- config/livewire.php | 2 +- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 74b0320f163f..50a82e8992aa 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -117,6 +117,15 @@ class Kernel extends HttpKernel 'bindings', 'query_logging', ], + 'livewire' => [ + Cors::class, + EncryptCookies::class, + AddQueuedCookiesToResponse::class, + StartSession::class, + ShareErrorsFromSession::class, + SubstituteBindings::class, + QueryLogging::class, + ], ]; /** diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 8a42098b2090..6da66c7935ac 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -262,7 +262,7 @@ class BillingPortalPurchase extends Component */ protected function getPaymentMethods(ClientContact $contact): self { - Auth::guard('contact')->login($contact); + Auth::guard('contact')->login($contact, true); $this->contact = $contact; diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 121074f3c9b2..5f934bc442ca 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -28,6 +28,6 @@ class VerifyCsrfToken extends Middleware * @var array */ protected $except = [ - 'livewire/message/*' + // 'livewire/message/*' ]; } diff --git a/composer.json b/composer.json index 9ad9f29185e9..804e2b5c302a 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "league/flysystem-cached-adapter": "^1.1", "league/fractal": "^0.17.0", "league/omnipay": "^3.1", - "livewire/livewire": "^2.0", + "livewire/livewire": "^2.4", "maennchen/zipstream-php": "^1.2", "nwidart/laravel-modules": "^8.0", "omnipay/paypal": "^3.0", diff --git a/composer.lock b/composer.lock index c088c92d6ea8..688d165b087e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9bb3b4b805f812254484a3a28b503978", + "content-hash": "407c398eefe5bab138b1d984a5116156", "packages": [ { "name": "asm/php-ansible", @@ -103,16 +103,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.183.9", + "version": "3.183.10", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "3b3aafdceac4cb820e2ae65a8785e4d07db471a7" + "reference": "3995354f4791f8ca85f5208325cef9065e471f3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3b3aafdceac4cb820e2ae65a8785e4d07db471a7", - "reference": "3b3aafdceac4cb820e2ae65a8785e4d07db471a7", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3995354f4791f8ca85f5208325cef9065e471f3b", + "reference": "3995354f4791f8ca85f5208325cef9065e471f3b", "shasum": "" }, "require": { @@ -187,9 +187,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.183.9" + "source": "https://github.com/aws/aws-sdk-php/tree/3.183.10" }, - "time": "2021-05-28T18:28:19+00:00" + "time": "2021-06-01T18:13:35+00:00" }, { "name": "bacon/bacon-qr-code", @@ -5157,16 +5157,16 @@ }, { "name": "php-http/discovery", - "version": "1.13.0", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "788f72d64c43dc361e7fcc7464c3d947c64984a7" + "reference": "778f722e29250c1fac0bbdef2c122fa5d038c9eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/788f72d64c43dc361e7fcc7464c3d947c64984a7", - "reference": "788f72d64c43dc361e7fcc7464c3d947c64984a7", + "url": "https://api.github.com/repos/php-http/discovery/zipball/778f722e29250c1fac0bbdef2c122fa5d038c9eb", + "reference": "778f722e29250c1fac0bbdef2c122fa5d038c9eb", "shasum": "" }, "require": { @@ -5183,8 +5183,7 @@ "puli/composer-plugin": "1.0.0-beta10" }, "suggest": { - "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories", - "puli/composer-plugin": "Sets up Puli which is recommended for Discovery to work. Check http://docs.php-http.org/en/latest/discovery.html for more details." + "php-http/message": "Allow to use Guzzle, Diactoros or Slim Framework factories" }, "type": "library", "extra": { @@ -5220,9 +5219,9 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.13.0" + "source": "https://github.com/php-http/discovery/tree/1.14.0" }, - "time": "2020-11-27T14:49:42+00:00" + "time": "2021-06-01T14:30:21+00:00" }, { "name": "php-http/guzzle7-adapter", diff --git a/config/livewire.php b/config/livewire.php index ac2afd93a4bc..eba83c79ccb3 100644 --- a/config/livewire.php +++ b/config/livewire.php @@ -67,7 +67,7 @@ return [ | */ - 'middleware_group' => 'web', + 'middleware_group' => 'livewire', /* |--------------------------------------------------------------------------