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 c01add22f4..c0e1e20947 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 53e4370aad..0000000000 --- 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 8c55b0134e..8698032a73 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 c175feae10..f459ac8106 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 a8f1bdc27c..df40f7d8ea 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 75f0f32907..9cb75f1b95 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 8e1debfd50..a2445a22b1 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 9c3a343fa7..b0c8d12ddb 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 %} - +