From 2ff2cc34c04c1c489fffed90524db84b069570af Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 14 Jun 2026 17:07:52 +0200 Subject: [PATCH] fix(auth): toaster on auth pages + audit email-link resets Codex review follow-ups: extract the notify toaster into a shared partial and include it in the auth layout too, so sendResetLink + recovery-code regenerate actually surface their confirmation (the auth layout had no toaster). Record an AuditEvent for password resets via the email-token path, matching the 2FA path. Co-Authored-By: Claude Opus 4.8 (1M context) --- app/Livewire/Auth/ResetPassword.php | 9 +++++++++ resources/views/layouts/app.blade.php | 23 +--------------------- resources/views/layouts/auth.blade.php | 1 + resources/views/partials/toaster.blade.php | 23 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 resources/views/partials/toaster.blade.php diff --git a/app/Livewire/Auth/ResetPassword.php b/app/Livewire/Auth/ResetPassword.php index 6718ba0..8c5e330 100644 --- a/app/Livewire/Auth/ResetPassword.php +++ b/app/Livewire/Auth/ResetPassword.php @@ -2,6 +2,7 @@ namespace App\Livewire\Auth; +use App\Models\AuditEvent; use Illuminate\Auth\Events\PasswordReset; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Password; @@ -50,6 +51,14 @@ class ResetPassword extends Component 'remember_token' => Str::random(60), ])->save(); + AuditEvent::create([ + 'user_id' => $user->id, + 'actor' => $user->name ?? 'system', + 'action' => 'password.reset', + 'target' => $user->email, + 'ip' => request()->ip(), + ]); + event(new PasswordReset($user)); }, ); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index b921e5a..4156df9 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -40,28 +40,7 @@ - {{-- Toaster: catches Livewire-dispatched `notify` browser events --}} -
- -
+ @include('partials.toaster') {{-- Command palette + keyboard shortcuts (persistent; one global keydown listener) --}} diff --git a/resources/views/layouts/auth.blade.php b/resources/views/layouts/auth.blade.php index 0afe069..9690b2d 100644 --- a/resources/views/layouts/auth.blade.php +++ b/resources/views/layouts/auth.blade.php @@ -78,6 +78,7 @@ + @include('partials.toaster') @livewireScripts diff --git a/resources/views/partials/toaster.blade.php b/resources/views/partials/toaster.blade.php new file mode 100644 index 0000000..9ee0f90 --- /dev/null +++ b/resources/views/partials/toaster.blade.php @@ -0,0 +1,23 @@ +{{-- Toaster: catches Livewire-dispatched `notify` browser events. Shared by the app + and auth layouts so notifications surface on every page. --}} +
+ +