Skip to content

Commit c284c85

Browse files
committed
refactor: simplify two-factor authentication logic with form components and improve conditional rendering
1 parent 94b4248 commit c284c85

File tree

2 files changed

+128
-164
lines changed

2 files changed

+128
-164
lines changed

app/Http/Controllers/Settings/TwoFactorAuthenticationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public function show(Request $request): Response
2121
return Inertia::render('settings/TwoFactor', [
2222
'confirmed' => $confirmed,
2323
'recoveryCodes' => $hasTwoFactorSecret ? json_decode(decrypt($user->two_factor_recovery_codes)) : [],
24-
'qrCodeSvg' => $hasTwoFactorSecret ? $user->twoFactorQrCodeSvg() : null,
25-
'secretKey' => $hasTwoFactorSecret ? decrypt($user->two_factor_secret) : null,
24+
'qrCodeSvg' => !$confirmed && $hasTwoFactorSecret ? $user->twoFactorQrCodeSvg() : null,
25+
'secretKey' => !$confirmed && $hasTwoFactorSecret ? decrypt($user->two_factor_secret) : null,
2626
]);
2727
}
2828
}

0 commit comments

Comments
 (0)