{{ __('Two-Factor Authentication') }}

{{-- Alerts --}} @if(session('status'))

{{ session('status') }}

@endif @if(session('success'))

{{ session('success') }}

@endif @if($errors->any())

{{ $errors->first() }}

@endif @if(!$user->twofa_enabled) {{-- ── Setup section: pick a method ── --}}

{{ __('Enable Two-Factor Authentication') }}

{{ __('Choose how you want to verify your identity each time you log in.') }}

{{-- Method tabs --}}
{{-- ── TOTP panel ── --}}

{{ __('Scan this QR code in your Authenticator app (e.g. Google Authenticator, Authy):') }}

@if($qrCode)
QR Code
@endif {{-- Manual entry fallback --}}

{{ __('Enter this setup key manually in your authenticator app:') }}

{{ chunk_split($user->twofa_secret, 4, ' ') }}

{{ __('Account:') }} {{ $user->email }}

@csrf
{{-- ── Email OTP panel ── --}}

{{ __('We will send a 6-digit code to') }} {{ $user->email }} {{ __('each time you log in.') }}

{{-- Step 1: request a code --}}
@csrf
{{-- Step 2: enter the code --}}
@if(session('email_code_sent'))

✓ {{ __('Code sent! Check your email.') }}

@endif
@csrf
@csrf
@else {{-- ── 2FA is enabled ── --}}

{{ __('Two-Factor Authentication is Enabled') }}

{{ $method === 'email' ? '✉️ Email' : '📱 Authenticator' }}

{{ __('Your account is protected with two-factor authentication.') }}

{{-- Backup codes --}} @if(session('backup_codes'))

{{ __('Save your backup codes') }}

{{ __('Download JSON') }}

{{ __('These codes will not be shown again. Store them somewhere safe. Each code can only be used once.') }}

@foreach(session('backup_codes') as $code) {{ $code }} @endforeach
@endif {{-- ── Switch Method ── --}}

{{ __('Choose a new method. Your current method remains active until the switch is confirmed.') }}

{{-- Tabs --}}
{{-- TOTP switch panel --}}
@if($method === 'totp')

{{ __('This is already your active method.') }}

@else

{{ __('Scan the QR code below in your Authenticator app, then enter the 6-digit code to confirm the switch.') }}

@if($qrCode)
QR Code
@endif
@csrf
@endif
{{-- Email switch panel --}}
@if($method === 'email')

{{ __('This is already your active method.') }}

@else

{{ __('We will send a 6-digit code to') }} {{ $user->email }}{{ __('. Enter it to confirm the switch.') }}

@csrf
@if(session('email_code_sent'))

✓ {{ __('Code sent! Check your email.') }}

@endif
@csrf
@csrf
@endif
@csrf
@csrf
@endif