feat(auth): autofocus auth form fields and profile 2FA OTP (#11324)

This commit is contained in:
Vinicius Cruz
2026-09-04 17:48:04 +02:00
committed by GitHub
parent 4ee460cfd0
commit ce7d17b7c5
2 changed files with 5 additions and 4 deletions
@@ -37,7 +37,7 @@
@readonly($readonly) @disabled($disabled) id="{{ $htmlId }}"
name="{{ $name }}" placeholder="{{ $attributes->get('placeholder') }}"
aria-placeholder="{{ $attributes->get('placeholder') }}"
@if ($autofocus) x-ref="autofocusInput" @endif>
@if ($autofocus) x-ref="autofocusInput" autofocus @endif>
@if ($allowToPeak)
<button type="button" x-on:click="type = type === 'password' ? 'text' : 'password'"
class="password-toggle flex absolute inset-y-0 right-0 z-10 items-center pr-2 cursor-pointer text-neutral-500 hover:text-black dark:text-neutral-400 dark:hover:text-white"
@@ -60,7 +60,7 @@
maxlength="{{ $attributes->get('maxlength') }}"
@if ($htmlId !== 'null') id={{ $htmlId }} @endif name="{{ $name }}"
placeholder="{{ $attributes->get('placeholder') }}"
@if ($autofocus) x-ref="autofocusInput" @endif>
@if ($autofocus) x-ref="autofocusInput" autofocus @endif>
@endif
@if (!$label && $helper)
<x-helper :helper="$helper" />
@@ -249,9 +249,10 @@
</p>
</div>
<form action="/user/confirmed-two-factor-authentication" method="POST"
class="flex items-end gap-2">
class="flex items-end gap-2"
x-init="$nextTick(() => $el.querySelector('input[name=code]')?.focus())">
@csrf
<x-forms.input type="text" inputmode="numeric" pattern="[0-9]*" id="code"
<x-forms.input name="code" type="text" inputmode="numeric" pattern="[0-9]*" id="code"
label="One-time code" required />
<x-forms.button type="submit">Validate 2FA</x-forms.button>
</form>