Server IP : 66.29.132.124 / Your IP : 18.191.189.119 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/laravel/fortify/src/Actions/ |
Upload File : |
<?php namespace Laravel\Fortify\Actions; use Illuminate\Support\Collection; use Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider; use Laravel\Fortify\Events\TwoFactorAuthenticationEnabled; use Laravel\Fortify\RecoveryCode; class EnableTwoFactorAuthentication { /** * The two factor authentication provider. * * @var \Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider */ protected $provider; /** * Create a new action instance. * * @param \Laravel\Fortify\Contracts\TwoFactorAuthenticationProvider $provider * @return void */ public function __construct(TwoFactorAuthenticationProvider $provider) { $this->provider = $provider; } /** * Enable two factor authentication for the user. * * @param mixed $user * @return void */ public function __invoke($user) { $user->forceFill([ 'two_factor_secret' => encrypt($this->provider->generateSecretKey()), 'two_factor_recovery_codes' => encrypt(json_encode(Collection::times(8, function () { return RecoveryCode::generate(); })->all())), ])->save(); TwoFactorAuthenticationEnabled::dispatch($user); } }