From b6967e84e7fb6fc9d67c44c154717f3ccaff2245 Mon Sep 17 00:00:00 2001 From: trmdi Date: Mon, 7 Oct 2024 11:12:17 +0700 Subject: [PATCH 1/2] Use built-in login validation --- views/login-mobile.handlebars | 19 ++++--------------- views/login.handlebars | 19 ++++--------------- views/login2.handlebars | 22 ++++------------------ 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/views/login-mobile.handlebars b/views/login-mobile.handlebars index 30940baea2..24f80c6202 100644 --- a/views/login-mobile.handlebars +++ b/views/login-mobile.handlebars @@ -63,15 +63,15 @@ - + - + - +
Username:
Password:
@@ -422,7 +422,6 @@ window.onresize = center; center(); - validateLogin(); validateCreate(); if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); } QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link. @@ -573,16 +572,6 @@ } } - function validateLogin(box, e) { - setTimeout(function(){ - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0)); - QE('loginButton', ok); - setDialogMode(0); - if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } } - if (e != null) { haltEvent(e); } - }, 100); - } - function validateCreate(box,e) { setDialogMode(0); var ok = false; @@ -818,4 +807,4 @@ - \ No newline at end of file + diff --git a/views/login.handlebars b/views/login.handlebars index 0ae7967622..edbda54226 100644 --- a/views/login.handlebars +++ b/views/login.handlebars @@ -55,15 +55,15 @@ - + - + - +
Username:
Password:
@@ -456,7 +456,6 @@ window.onresize = center; center(); - validateLogin(); validateCreate(); if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); } QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link. @@ -661,16 +660,6 @@ } } - function validateLogin(box, e) { - setTimeout(function(){ - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0)); - QE('loginButton', ok); - setDialogMode(0); - if ((e != null) && (e.keyCode == 13)) { if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); } else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); } } - if (e != null) { haltEvent(e); } - }, 100); - } - function validateCreate(box, e) { setDialogMode(0); var userok = false; @@ -971,4 +960,4 @@ - \ No newline at end of file + diff --git a/views/login2.handlebars b/views/login2.handlebars index bbd78a5563..2b94646e78 100644 --- a/views/login2.handlebars +++ b/views/login2.handlebars @@ -69,12 +69,12 @@ @@ -84,7 +84,7 @@ @@ -529,7 +529,6 @@ if (authStrategies.indexOf('saml') >= 0) { QV('auth-saml', true); } } - validateLogin(); validateCreate(); if (loginMode.length != 0) { go(parseInt(loginMode)); } else { go(1); } QV('newAccountDiv', (newAccount === '1') || (newAccount === 'true')); // If new accounts are not allowed, don't display the new account link. @@ -772,19 +771,6 @@ if (!formSubmitted) { formSubmitted = true; document.getElementById(v).submit(); } } - function validateLogin(box, e) { - setTimeout(function(){ - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0)); - QE('loginButton', ok); - setDialogMode(0); - if ((e != null) && (e.keyCode == 13)) { - if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); } - else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); } - } - if (e != null) { haltEvent(e); } - }, 100); - } - function validateCreate(box, e) { setDialogMode(0); var userok = false; @@ -1041,4 +1027,4 @@ - \ No newline at end of file + From b1b8f15f45fdd6b78e2e0e8996f90b2e26ec3417 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Sat, 19 Oct 2024 16:43:07 +0100 Subject: [PATCH 2/2] use button instead of submit to avoid duplicate submits --- views/login2.handlebars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/login2.handlebars b/views/login2.handlebars index 2b94646e78..8c6bdc32cd 100644 --- a/views/login2.handlebars +++ b/views/login2.handlebars @@ -84,7 +84,7 @@
- +
- +
- +
- +