{{-- Shared Two-Factor Authentication setup panel. Expected variables: - $twofaEnabled bool — whether 2FA is already confirmed for the user - $pending2fa array|null — ['secret' => ..., 'uri' => ...] when setup is pending - $confirmRoute string — POST endpoint that verifies the first code - $disableRoute string — POST endpoint that turns 2FA off - $recoveryRoute string — POST endpoint that regenerates recovery codes Uses: FontAwesome + the qrcode.js library loaded from a CDN. Pure client-side, no external API call happens for QR rendering — the otpauth:// URI is passed straight to the library in the browser. --}} @once @push('styles') @endpush @endonce
Two-Factor Authentication {{ $twofaEnabled ? 'Enabled' : 'Disabled' }}
@if($errors->any())
{{ $errors->first() }}
@endif @if(session('recovery_codes'))
Your recovery codes

Store these somewhere safe. Each can be used once to sign in if you lose your authenticator device. You won't see them again after leaving this page.

@foreach(session('recovery_codes') as $code)
{{ $code }}
@endforeach
@endif @if(!$twofaEnabled && $pending2fa) {{-- Setup flow: show QR + manual secret, collect first TOTP --}}

Scan the QR code below with Google Authenticator, Authy, or any compatible app — then enter the 6-digit code to finish enabling 2FA.

{{ $pending2fa['secret'] }}
Type this into your authenticator app manually if the QR won't scan.
@csrf
@elseif($twofaEnabled) {{-- 2FA is on: offer disable + recovery regeneration --}}
Two-factor authentication is active on your account. You'll be prompted for a code from your authenticator app each time you sign in.
@csrf
Regenerate recovery codes

Creates a fresh set of recovery codes. Your existing codes will stop working immediately.

@csrf
Disable 2FA

Turns off two-factor authentication. You'll be able to sign in with just your password again.

@else

2FA setup is temporarily unavailable. Refresh and try again.

@endif