Skip to content

Commit bd7faef

Browse files
authored
set password in session on update for inertia (#1411)
1 parent 7f790e4 commit bd7faef

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"ext-json": "*",
1919
"illuminate/console": "^10.17",
2020
"illuminate/support": "^10.17",
21-
"laravel/fortify": "^1.15",
21+
"laravel/fortify": "^1.19",
2222
"mobiledetect/mobiledetectlib": "^4.8"
2323
},
2424
"require-dev": {

src/JetstreamServiceProvider.php

+9
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
use Illuminate\Contracts\Http\Kernel;
77
use Illuminate\Http\RedirectResponse;
88
use Illuminate\Http\Request;
9+
use Illuminate\Support\Facades\Auth;
10+
use Illuminate\Support\Facades\Event;
911
use Illuminate\Support\Facades\Route;
1012
use Illuminate\Support\ServiceProvider;
1113
use Illuminate\View\Compilers\BladeCompiler;
1214
use Inertia\Inertia;
15+
use Laravel\Fortify\Events\PasswordUpdatedViaController;
1316
use Laravel\Fortify\Fortify;
1417
use Laravel\Jetstream\Http\Livewire\ApiTokenManager;
1518
use Laravel\Jetstream\Http\Livewire\CreateTeamForm;
@@ -178,6 +181,12 @@ protected function bootInertia()
178181
$kernel->appendToMiddlewarePriority(HandleInertiaRequests::class);
179182
}
180183

184+
Event::listen(function (PasswordUpdatedViaController $event) {
185+
if (request()->hasSession()) {
186+
request()->session()->put(['password_hash_sanctum' => Auth::user()->getAuthPassword()]);
187+
}
188+
});
189+
181190
Fortify::loginView(function () {
182191
return Inertia::render('Auth/Login', [
183192
'canResetPassword' => Route::has('password.request'),

0 commit comments

Comments
 (0)