Skip to content

Commit b3a9864

Browse files
committed
Restore VerifyCsrfToken middleware
1 parent de5e24d commit b3a9864

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

demo-app/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo-app/tests/Feature/DispatchBaseUrlRequestTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ public function it_creates_new_request_with_original_properties()
4545
#[Test]
4646
public function it_preserves_request_data()
4747
{
48+
session()->start();
49+
4850
$originalRequest = Request::create(
49-
'/users', 'POST', [], [], [], [], json_encode(['name' => 'new-role'])
51+
'/users', 'POST', [], [], [], [], json_encode([
52+
'_token' => session()->token(),
53+
'name' => 'new-role',
54+
])
5055
);
5156
$originalRequest->headers->set('Content-Type', 'application/json');
5257

react/package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@inertiaui/modal-react",
33
"author": "Pascal Baljet <[email protected]>",
4-
"version": "0.20.2",
4+
"version": "0.20.3",
55
"private": false,
66
"license": "MIT",
77
"type": "module",

src/ModalServiceProvider.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace InertiaUI\Modal;
66

77
use Illuminate\Cookie\Middleware\EncryptCookies;
8-
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
98
use Illuminate\Routing\Router;
109
use Illuminate\Support\ServiceProvider;
1110
use Illuminate\Support\Str;
@@ -38,10 +37,8 @@ public function boot(): void
3837
}
3938
});
4039

41-
Modal::excludeMiddlewareOnBaseUrl([
42-
EncryptCookies::class, // Prevent double encryption of cookies in subrequests
43-
VerifyCsrfToken::class, // Don't validate CSRF tokens twice
44-
]);
40+
// Prevent double encryption of cookies in subrequests
41+
Modal::excludeMiddlewareOnBaseUrl(EncryptCookies::class);
4542

4643
Router::macro('setCurrentRequest', function ($request): void {
4744
// @phpstan-ignore-next-line

vue/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@inertiaui/modal-vue",
3-
"version": "0.20.2",
3+
"version": "0.20.3",
44
"author": "Pascal Baljet <[email protected]>",
55
"private": false,
66
"license": "MIT",

0 commit comments

Comments
 (0)