Skip to content

Commit

Permalink
Dispatch RecoveryCodeReplaced Event (#564)
Browse files Browse the repository at this point in the history
* dispatch RecoveryCodeReplaced event

* Make event dispatchable

* Update RecoveryCodeReplaced.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
stephenjude and taylorotwell committed Aug 20, 2024
1 parent 958042c commit fbe67f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Events/RecoveryCodeReplaced.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions src/TwoFactorAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;
use Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider;
use Laravel\Fortify\Events\RecoveryCodeReplaced;

trait TwoFactorAuthenticatable
{
Expand Down Expand Up @@ -52,6 +53,8 @@ public function replaceRecoveryCode($code)
decrypt($this->two_factor_recovery_codes)
)),
])->save();

RecoveryCodeReplaced::dispatch($this, $code);
}

/**
Expand Down

0 comments on commit fbe67f0

Please sign in to comment.