File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
Http/Controllers/Settings Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change 33namespace App \Http \Controllers \Settings ;
44
55use App \Http \Controllers \Controller ;
6+ use App \Models \User ;
67use Illuminate \Http \Request ;
78use Inertia \Inertia ;
89use Inertia \Response ;
@@ -14,21 +15,16 @@ class TwoFactorAuthenticationController extends Controller
1415 */
1516 public function show (Request $ request ): Response
1617 {
18+ /** @var User $user */
1719 $ user = $ request ->user ();
1820
1921 $ confirmed = filled ($ user ->two_factor_confirmed_at );
20- $ hasSecret = filled ($ user ->two_factor_secret );
21- $ showSetup = ! $ confirmed && $ hasSecret ;
22-
23- $ recoveryCodes = $ hasSecret && filled ($ user ->two_factor_recovery_codes )
24- ? (json_decode (decrypt ($ user ->two_factor_recovery_codes ), true ) ?: [])
25- : [];
2622
2723 return Inertia::render ('settings/TwoFactor ' , [
2824 'confirmed ' => $ confirmed ,
29- 'recoveryCodes ' => $ recoveryCodes ,
30- 'qrCodeSvg ' => $ showSetup ? $ user ->twoFactorQrCodeSvg () : null ,
31- 'secretKey ' => $ showSetup ? decrypt ($ user ->two_factor_secret ) : null ,
25+ 'recoveryCodes ' => filled ( $ user -> two_factor_secret ) ? json_decode ( decrypt ( $ user -> two_factor_recovery_codes )) : [] ,
26+ 'qrCodeSvg ' => ! $ confirmed && filled ( $ user -> two_factor_secret ) ? $ user ->twoFactorQrCodeSvg () : null ,
27+ 'secretKey ' => ! $ confirmed && filled ( $ user -> two_factor_secret ) ? decrypt ($ user ->two_factor_secret ) : null ,
3228 ]);
3329 }
3430}
Original file line number Diff line number Diff line change 66use Illuminate \Http \Request ;
77use Illuminate \Support \Facades \RateLimiter ;
88use Illuminate \Support \ServiceProvider ;
9- use Illuminate \Support \Str ;
109use Inertia \Inertia ;
1110use Laravel \Fortify \Fortify ;
1211
@@ -25,12 +24,6 @@ public function boot(): void
2524 return Inertia::render ('auth/ConfirmPassword ' );
2625 });
2726
28- RateLimiter::for ('login ' , function (Request $ request ) {
29- $ throttleKey = Str::transliterate (Str::lower ((string ) $ request ->string (Fortify::username ())).'| ' .$ request ->ip ());
30-
31- return Limit::perMinute (5 )->by ($ throttleKey );
32- });
33-
3427 RateLimiter::for ('two-factor ' , function (Request $ request ) {
3528 return Limit::perMinute (5 )->by ($ request ->session ()->get ('login.id ' ));
3629 });
You can’t perform that action at this time.
0 commit comments