From 2a308cd559f434078562ab724007b43aed6c9ea4 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 14 Feb 2024 11:57:05 +0200 Subject: [PATCH] autofocus for login templates --- files/assets/js/core.js | 4 ++++ files/assets/js/login_2fa.js | 1 - files/templates/login/forgot_password.html | 2 +- files/templates/login/login.html | 2 +- files/templates/login/login_2fa.html | 3 +-- files/templates/login/lost_2fa.html | 2 +- files/templates/login/reset_password.html | 2 +- files/templates/login/sign_up.html | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 files/assets/js/login_2fa.js diff --git a/files/assets/js/core.js b/files/assets/js/core.js index c01add22f..c0e1e2094 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -791,3 +791,7 @@ function delReport(t, url) { } ); } + +for (const el of document.getElementsByClassName('autofocus')) { + el.focus() +} diff --git a/files/assets/js/login_2fa.js b/files/assets/js/login_2fa.js deleted file mode 100644 index 53e4370aa..000000000 --- a/files/assets/js/login_2fa.js +++ /dev/null @@ -1 +0,0 @@ -document.getElementById('2fa_token').focus(); diff --git a/files/templates/login/forgot_password.html b/files/templates/login/forgot_password.html index 8c55b0134..8698032a7 100644 --- a/files/templates/login/forgot_password.html +++ b/files/templates/login/forgot_password.html @@ -5,7 +5,7 @@ {% block content %}
- + diff --git a/files/templates/login/login.html b/files/templates/login/login.html index c175feae1..f459ac810 100644 --- a/files/templates/login/login.html +++ b/files/templates/login/login.html @@ -14,7 +14,7 @@ {%- endset -%} {% if failed %}{{macros.alert(error_text, true)}}{% endif %} - + diff --git a/files/templates/login/login_2fa.html b/files/templates/login/login_2fa.html index a8f1bdc27..df40f7d8e 100644 --- a/files/templates/login/login_2fa.html +++ b/files/templates/login/login_2fa.html @@ -15,10 +15,9 @@ - + Lost your two-factor authentication device?
- {% endblock %} diff --git a/files/templates/login/lost_2fa.html b/files/templates/login/lost_2fa.html index 75f0f3290..9cb75f1b9 100644 --- a/files/templates/login/lost_2fa.html +++ b/files/templates/login/lost_2fa.html @@ -5,7 +5,7 @@ {% block content %}
- + diff --git a/files/templates/login/reset_password.html b/files/templates/login/reset_password.html index 8e1debfd5..a2445a22b 100644 --- a/files/templates/login/reset_password.html +++ b/files/templates/login/reset_password.html @@ -7,7 +7,7 @@ - + diff --git a/files/templates/login/sign_up.html b/files/templates/login/sign_up.html index 9c3a343fa..b0c8d12dd 100644 --- a/files/templates/login/sign_up.html +++ b/files/templates/login/sign_up.html @@ -67,7 +67,7 @@ {% if redirect %}{% endif %} {% if ref_user %}{% endif %} - +