61 lines
3.9 KiB
PHP
61 lines
3.9 KiB
PHP
@php
|
|
$field = 'h-14 w-full rounded-md border border-line bg-inset text-center font-mono text-2xl font-semibold tracking-[0.5em] text-ink caret-accent placeholder:text-ink-4 focus:border-accent/40 focus:outline-none';
|
|
$fieldText = 'h-12 w-full rounded-md border border-line bg-inset px-3 text-center font-mono text-sm text-ink placeholder:text-ink-4 focus:border-accent/40 focus:outline-none';
|
|
$label = 'mb-1.5 block font-mono text-[11px] uppercase tracking-wider text-ink-3';
|
|
$err = 'mt-1.5 flex items-center gap-1.5 font-mono text-[11px] text-offline';
|
|
@endphp
|
|
|
|
<div class="space-y-7">
|
|
<div class="space-y-1.5">
|
|
<p class="font-mono text-[10px] font-semibold uppercase tracking-[0.18em] text-accent-text">{{ __('auth.two_factor') }}</p>
|
|
<h1 class="font-display text-2xl font-bold tracking-tight text-ink">{{ __('auth.challenge_heading') }}</h1>
|
|
<p class="font-mono text-xs text-ink-3">{{ $this->pendingHasTotp ? __('auth.challenge_subtitle') : __('auth.challenge_key_subtitle') }}</p>
|
|
</div>
|
|
|
|
@if (! $this->pendingHasTotp && $this->webauthnAvailable())
|
|
{{-- Key-only: the security key is the primary path. --}}
|
|
<x-btn variant="primary" size="lg" class="w-full" x-data x-on:click="window.clusevWebauthn?.login($wire)">
|
|
<x-icon name="shield" class="h-4 w-4" /> {{ __('auth.webauthn_login') }}
|
|
</x-btn>
|
|
<div class="flex items-center gap-3">
|
|
<span class="h-px flex-1 bg-line"></span>
|
|
<span class="font-mono text-[10px] uppercase tracking-wider text-ink-4">{{ __('common.or') }}</span>
|
|
<span class="h-px flex-1 bg-line"></span>
|
|
</div>
|
|
@endif
|
|
|
|
<form wire:submit="verify" class="space-y-4">
|
|
<div>
|
|
<label for="code" class="{{ $label }}">{{ $this->pendingHasTotp ? __('auth.code') : __('auth.challenge_backup_label') }}</label>
|
|
<input wire:model="code" id="code" inputmode="text" autocomplete="one-time-code" autofocus
|
|
class="{{ $this->pendingHasTotp ? $field : $fieldText }}"
|
|
placeholder="{{ $this->pendingHasTotp ? '000000' : __('auth.challenge_backup_placeholder') }}" />
|
|
@error('code') <p class="{{ $err }}"><x-icon name="alert" class="h-3.5 w-3.5 shrink-0" />{{ $message }}</p> @enderror
|
|
<p class="mt-2 text-center font-mono text-[11px] text-ink-4">{{ $this->pendingHasTotp ? __('auth.challenge_recovery_hint') : __('auth.challenge_backup_only_hint') }}</p>
|
|
</div>
|
|
|
|
<x-btn variant="primary" size="lg" type="submit" class="w-full" wire:loading.attr="disabled" wire:target="verify">
|
|
<svg wire:loading wire:target="verify" class="h-4 w-4 animate-spin" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true"><path d="M21 12a9 9 0 1 1-6.219-8.56" stroke-linecap="round" /></svg>
|
|
<span wire:loading.remove wire:target="verify">{{ __('common.confirm') }}</span>
|
|
<span wire:loading wire:target="verify">{{ __('auth.checking') }}</span>
|
|
</x-btn>
|
|
</form>
|
|
|
|
@if ($this->pendingHasTotp && $this->webauthnAvailable())
|
|
<div class="flex items-center gap-3">
|
|
<span class="h-px flex-1 bg-line"></span>
|
|
<span class="font-mono text-[10px] uppercase tracking-wider text-ink-4">{{ __('common.or') }}</span>
|
|
<span class="h-px flex-1 bg-line"></span>
|
|
</div>
|
|
<x-btn variant="secondary" size="lg" class="w-full" x-data x-on:click="window.clusevWebauthn?.login($wire)">
|
|
<x-icon name="shield" class="h-4 w-4" /> {{ __('auth.webauthn_login') }}
|
|
</x-btn>
|
|
@endif
|
|
|
|
<div class="flex justify-center">
|
|
<a href="{{ route('login') }}" wire:navigate class="inline-flex items-center gap-1.5 font-mono text-[11px] text-ink-4 transition-colors hover:text-ink-2">
|
|
<x-icon name="chevron-left" class="h-3.5 w-3.5" /> {{ __('auth.back_to_login') }}
|
|
</a>
|
|
</div>
|
|
</div>
|