From fbe67f018c1fe26d00913de56a6d60589b4be9b2 Mon Sep 17 00:00:00 2001 From: Stephen Jude <31182887+stephenjude@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:43:56 +0100 Subject: [PATCH] Dispatch RecoveryCodeReplaced Event (#564) * dispatch RecoveryCodeReplaced event * Make event dispatchable * Update RecoveryCodeReplaced.php --------- Co-authored-by: Taylor Otwell --- src/Events/RecoveryCodeReplaced.php | 3 ++- src/TwoFactorAuthenticatable.php | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Events/RecoveryCodeReplaced.php b/src/Events/RecoveryCodeReplaced.php index 12fc3113..3486b911 100644 --- a/src/Events/RecoveryCodeReplaced.php +++ b/src/Events/RecoveryCodeReplaced.php @@ -2,11 +2,12 @@ namespace Laravel\Fortify\Events; +use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; class RecoveryCodeReplaced { - use SerializesModels; + use Dispatchable, SerializesModels; /** * The authenticated user. diff --git a/src/TwoFactorAuthenticatable.php b/src/TwoFactorAuthenticatable.php index 91d6ee3f..ae561078 100644 --- a/src/TwoFactorAuthenticatable.php +++ b/src/TwoFactorAuthenticatable.php @@ -9,6 +9,7 @@ use BaconQrCode\Renderer\RendererStyle\RendererStyle; use BaconQrCode\Writer; use Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider; +use Laravel\Fortify\Events\RecoveryCodeReplaced; trait TwoFactorAuthenticatable { @@ -52,6 +53,8 @@ public function replaceRecoveryCode($code) decrypt($this->two_factor_recovery_codes) )), ])->save(); + + RecoveryCodeReplaced::dispatch($this, $code); } /**