From 94ea4430ba93eca684767b9a0004c1d18221fec4 Mon Sep 17 00:00:00 2001 From: Paul McKay Date: Wed, 20 Dec 2023 17:06:09 +0000 Subject: [PATCH] fix password reset page by adding middleware, and make the rediret after login configurable --- config/filament-invite.php | 1 + src/FilamentInviteServiceProvider.php | 6 ++++++ src/Http/Livewire/Accept.php | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/filament-invite.php b/config/filament-invite.php index bdcdd33..3e2ab55 100644 --- a/config/filament-invite.php +++ b/config/filament-invite.php @@ -3,4 +3,5 @@ // config for Concept7/FilamentInvite return [ 'expiration_time_in_hours' => '24', + 'after_login_redirect_route' => 'filament.admin.pages.dashboard', ]; diff --git a/src/FilamentInviteServiceProvider.php b/src/FilamentInviteServiceProvider.php index 2d826f0..7094ed9 100644 --- a/src/FilamentInviteServiceProvider.php +++ b/src/FilamentInviteServiceProvider.php @@ -8,6 +8,8 @@ use Livewire\Livewire; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; +use Illuminate\Cookie\Middleware\EncryptCookies; +use Illuminate\Session\Middleware\StartSession; class FilamentInviteServiceProvider extends PackageServiceProvider { @@ -69,6 +71,10 @@ public function panel(Panel $panel): Panel return $panel ->id('invite') ->path('invite') + ->middleware([ + EncryptCookies::class, + StartSession::class, + ]) ->pages([ Accept::class, ]); diff --git a/src/Http/Livewire/Accept.php b/src/Http/Livewire/Accept.php index 8e2f10d..8f807de 100644 --- a/src/Http/Livewire/Accept.php +++ b/src/Http/Livewire/Accept.php @@ -126,7 +126,7 @@ public function submit() return route('filament.auth.login'); } - return redirect()->intended(route('filament.admin.pages.dashboard')); + return redirect()->intended(route(config('filament-invite.after_login_redirect_route'))); }