fix login button disabled when autofilled #6428

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Oct 5, 2024 at 16:59 UTC ec7505987dc83982ed5eeaef7c4cc0230bfc48aa
3 files changed +24 -18
views/login-mobile.handlebars
+7 -5
@@ -574,11 +574,13 @@
574 }
575
576 function validateLogin(box, e) {
577 - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
578 - QE('loginButton', ok);
579 - setDialogMode(0);
580 - if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } }
581 - if (e != null) { haltEvent(e); }
577 + setTimeout(function(){
578 + var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
579 + QE('loginButton', ok);
580 + setDialogMode(0);
581 + if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } }
582 + if (e != null) { haltEvent(e); }
583 + }, 100);
584 }
585
586 function validateCreate(box,e) {
views/login.handlebars
+7 -5
@@ -662,11 +662,13 @@
662 }
663
664 function validateLogin(box, e) {
665 - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
666 - QE('loginButton', ok);
667 - setDialogMode(0);
668 - 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(); } }
669 - if (e != null) { haltEvent(e); }
665 + setTimeout(function(){
666 + var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
667 + QE('loginButton', ok);
668 + setDialogMode(0);
669 + 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(); } }
670 + if (e != null) { haltEvent(e); }
671 + }, 100);
672 }
673
674 function validateCreate(box, e) {
views/login2.handlebars
+10 -8
@@ -773,14 +773,16 @@
773 }
774
775 function validateLogin(box, e) {
776 - var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
777 - QE('loginButton', ok);
778 - setDialogMode(0);
779 - if ((e != null) && (e.keyCode == 13)) {
780 - if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); }
781 - else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); }
782 - }
783 - if (e != null) { haltEvent(e); }
776 + setTimeout(function(){
777 + var ok = ((Q('username').value.length > 0) && (Q('username').value.indexOf(' ') == -1) && (Q('password').value.length > 0));
778 + QE('loginButton', ok);
779 + setDialogMode(0);
780 + if ((e != null) && (e.keyCode == 13)) {
781 + if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); }
782 + else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); }
783 + }
784 + if (e != null) { haltEvent(e); }
785 + }, 100);
786 }
787
788 function validateCreate(box, e) {