@extends('layouts.auth') @section('content') @php /** * Enrol / manage the authenticator second factor for the signed-in account. * * Rendered in the auth layout, which is the same centred card /login, /register and /reset * already use — this is an account-security step rather than a dashboard settings page, and * the roles that reach it (admin, vendor, staff, driver, customer) do not share a dashboard * chrome. No new styles: .qm-auth-title / .qm-auth-sub / .qm-auth-form and the project's * existing .qm-btn, .qm-hint, .qm-pw-wrap, exactly as auth/reset.php uses them. * * The QR is drawn HERE, in the browser, from the bundled qrcode.min.js the QR card, table * card and TV screens already load. The secret never leaves this server. * * @var bool $twoFactorOn * @var bool $twoFactorReq the operator has made 2FA compulsory for this role * @var string $secret base32 shared secret (only when not yet enrolled) * @var string $otpUri otpauth:// URI for the QR * @var int $recoveryLeft * @var array $recoveryCodes shown once, immediately after minting */ $twoFactorOn = (bool) ($twoFactorOn ?? false); $twoFactorReq = (bool) ($twoFactorReq ?? false); $secret = (string) ($secret ?? ''); $otpUri = (string) ($otpUri ?? ''); $recoveryLeft = (int) ($recoveryLeft ?? 0); $recoveryCodes = (array) ($recoveryCodes ?? []); @endphp

{{ t_raw('account.two_factor_title') }}

{!! $twoFactorOn ? t('account.two_factor_on_sub') : t('account.two_factor_off_sub') !!}

@if ($recoveryCodes !== [])
@foreach ($recoveryCodes as $rc){{ (string) $rc }}@endforeach

{{ t_raw('account.recovery_codes_once') }}

@endif @if (!$twoFactorOn) @if ($secret === '')

{{ t_raw('account.two_factor_unavailable') }}

@else
@csrf
@endif @else

{{ t_raw('account.recovery_codes_left', [':n' => (string) $recoveryLeft]) }}

@php /* Recovery codes walk past the second factor, so minting a fresh set is the same act of trust as switching the factor off — and asks for the same proof. The field below is the disable form's, id apart: two ids of one name on a page would collide. */ @endphp
@csrf
@if (!$twoFactorReq)
@csrf
@endif @endif

{{ t_raw('nav.dashboard') }}

@endsection