diff --git a/index.html b/index.html index f991628..677d12a 100644 --- a/index.html +++ b/index.html @@ -8108,6 +8108,13 @@ if (!setup) { if ($('authUsername')) $('authUsername').value = localStorage.getItem('apRememberedUser') || ''; if ($('rememberUser')) $('rememberUser').checked = !!localStorage.getItem('apRememberedUser') } else { if ($('authUsername')) $('authUsername').value = ''; if ($('rememberUser')) $('rememberUser').checked = false; } hideLoaderScreen(); + setTimeout(() => { + if ($('authUsername') && $('authUsername').value.trim()) { + if ($('authPassword')) $('authPassword').focus(); + } else if ($('authUsername')) { + $('authUsername').focus(); + } + }, 50); } function showApp() { @@ -14058,6 +14065,42 @@ ${vpnBadgeTopo} } catch (e) { message.textContent = tErr(e.message); } }; + if ($('authUsername')) { + $('authUsername').addEventListener('keydown', (e) => { + if (e.key === ' ' || e.code === 'Space') { + e.preventDefault(); + if ($('authPassword')) { + $('authPassword').focus(); + $('authPassword').select(); + } + } else if (e.key === 'Enter') { + e.preventDefault(); + if ($('authPassword')) { + $('authPassword').focus(); + $('authPassword').select(); + } + } + }); + } + + if ($('authPassword')) { + $('authPassword').addEventListener('keydown', (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + if ($('authSubmit')) $('authSubmit').click(); + } + }); + } + + if ($('authOtp')) { + $('authOtp').addEventListener('keydown', (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + if ($('authSubmit')) $('authSubmit').click(); + } + }); + } + $('saveAuth').onclick = () => runAction(async () => { const message = $('authSettingsMessage'); const password = $('authSettingsPassword').value; const confirmation = $('authSettingsPasswordConfirm').value; if (password !== confirmation) { message.textContent = tErr('Erreur : les mots de passe ne correspondent pas'); return; }