Code sent to
{
$event.target.closest('form').dispatchEvent(new Event('submit'));
}, 350);
}
"
@keydown="
if ($event.key === 'Backspace' && !resetCode[index] && index > 0) {
const prevInput = document.querySelector('#code-' + (index - 1));
if (prevInput) {
prevInput.focus();
prevInput.select();
}
}
"
@paste="
$event.preventDefault();
const pastedData = ($event.clipboardData || window.clipboardData).getData('text');
const digits = pastedData.replace(/\D/g, '').slice(0, 6);
digits.split('').forEach((digit, i) => {
if (resetCode[i] !== undefined) {
resetCode[i] = digit;
const input = document.querySelector('#code-' + i);
if (input) {
input.classList.add('code-box-filled');
}
}
});
const nextIndex = Math.min(digits.length, 5);
const nextInput = document.querySelector('#code-' + nextIndex);
if (nextInput) {
nextInput.focus();
nextInput.select();
}
if (digits.length === 6) {
setTimeout(() => {
$event.target.closest('form').dispatchEvent(new Event('submit'));
}, 350);
}
"
@focus="() => { document.querySelector('#code-' + index)?.classList.add('code-box-active') }"
@blur="() => { document.querySelector('#code-' + index)?.classList.remove('code-box-active') }"
class="code-box"
:class="resetCode[index] ? 'code-box-filled' : ''"
inputmode="numeric"
autocomplete="off"
required>
Code expires in