59 lines
2.9 KiB
PHP
59 lines
2.9 KiB
PHP
<section>
|
|
<header>
|
|
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Autenticazione a due fattori (App)</h2>
|
|
<p class="mt-1 text-sm text-gray-600 dark:text-gray-400">Usa Google Authenticator, Microsoft Authenticator o app compatibile TOTP.</p>
|
|
</header>
|
|
|
|
@if (session('status') === 'two-factor-enabled')
|
|
<p class="mt-3 text-sm text-green-700">2FA attivata correttamente.</p>
|
|
@endif
|
|
|
|
@if (session('status') === 'two-factor-disabled')
|
|
<p class="mt-3 text-sm text-yellow-700">2FA disattivata.</p>
|
|
@endif
|
|
|
|
@if (! $user->hasTwoFactorEnabled())
|
|
@if (!empty($twoFactorPendingSecret ?? null))
|
|
<div class="mt-4 p-4 border rounded bg-gray-50">
|
|
<p class="text-sm mb-2">1) Inserisci questa chiave nell'app Authenticator:</p>
|
|
<code class="block p-2 bg-white border rounded text-sm break-all">{{ $twoFactorPendingSecret }}</code>
|
|
|
|
@if(!empty($twoFactorPendingUri ?? null))
|
|
<p class="text-xs text-gray-600 mt-2">URI OTP:</p>
|
|
<code class="block p-2 bg-white border rounded text-xs break-all">{{ $twoFactorPendingUri }}</code>
|
|
@endif
|
|
|
|
<form method="POST" action="{{ route('profile.two-factor.confirm') }}" class="mt-4 space-y-3">
|
|
@csrf
|
|
<div>
|
|
<x-input-label for="code" :value="__('2) Inserisci il codice a 6 cifre')" />
|
|
<x-text-input id="code" name="code" type="text" maxlength="6" class="mt-1 block w-full" required />
|
|
<x-input-error class="mt-2" :messages="$errors->get('code')" />
|
|
</div>
|
|
<x-primary-button>Conferma e Attiva 2FA</x-primary-button>
|
|
</form>
|
|
</div>
|
|
@else
|
|
<form method="POST" action="{{ route('profile.two-factor.enable') }}" class="mt-4">
|
|
@csrf
|
|
<x-primary-button>Abilita 2FA con App</x-primary-button>
|
|
</form>
|
|
@endif
|
|
@else
|
|
<div class="mt-4 p-4 border rounded bg-green-50">
|
|
<p class="text-sm text-green-700">2FA attiva dal {{ optional($user->two_factor_confirmed_at)->format('d/m/Y H:i') }}.</p>
|
|
<p class="text-xs text-gray-600 mt-2">In login dovrai inserire il codice OTP della tua app.</p>
|
|
</div>
|
|
|
|
<form method="POST" action="{{ route('profile.two-factor.disable') }}" class="mt-4 space-y-3">
|
|
@csrf
|
|
<div>
|
|
<x-input-label for="two_factor_disable_password" :value="__('Password conferma disattivazione')" />
|
|
<x-text-input id="two_factor_disable_password" name="password" type="password" class="mt-1 block w-full" required />
|
|
<x-input-error class="mt-2" :messages="$errors->get('password')" />
|
|
</div>
|
|
<x-danger-button>Disabilita 2FA</x-danger-button>
|
|
</form>
|
|
@endif
|
|
</section>
|