restore login screen enter button use #6494

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

si458 committed Nov 5, 2024 at 15:41 UTC 9ebd23a5182cc5a63b359ccb57eac0f9b49d4934
3 files changed +34 -6
views/login-mobile.handlebars
+11 -2
@@ -63,11 +63,11 @@
63 <table>
64 <tr>
65 <td id=loginusername align=right width=100>Username:</td>
66 - <td><input id=username type=text autocomplete="username" maxlength=64 name=username required /></td>
66 + <td><input id=username type=text autocomplete="username" maxlength=64 name=username required onchange=validateLogin(1) onkeyup=validateLogin(1,event) /></td>
67 </tr>
68 <tr>
69 <td align=right>Password:</td>
70 - <td><input id=password type=password autocomplete="current-password" maxlength=256 name=password autocomplete=off required /></td>
70 + <td><input id=password type=password autocomplete="current-password" maxlength=256 name=password autocomplete=off required onchange=validateLogin(2) onkeyup=validateLogin(2,event) /></td>
71 </tr>
72 <tr>
73 <td><div id=showPassHintLink style=display:none><a onclick=showPassHint() style="cursor:pointer">Show Hint</a></div></td>
@@ -572,6 +572,15 @@
572 }
573 }
574
575 + function validateLogin(box, e) {
576 + setTimeout(function(){
577 + setDialogMode(0);
578 + if ((e != null) && (e.keyCode == 13)) { if (box == 1) { Q('password').focus(); } else if (box == 2) { Q('loginButton').click(); } }
579 + if (e != null) { haltEvent(e); }
580 + }, 100);
581 + }
582 +
583 +
584 function validateCreate(box,e) {
585 setDialogMode(0);
586 var ok = false;
views/login.handlebars
+10 -2
@@ -55,11 +55,11 @@
55 <table>
56 <tr>
57 <td id=loginusername align=right width=100>Username:</td>
58 - <td><input id=username {{{autocomplete}}}="username" type=text maxlength=64 name=username required /></td>
58 + <td><input id=username {{{autocomplete}}}="username" type=text maxlength=64 name=username required onchange=validateLogin(1) onkeyup=validateLogin(1,event) /></td>
59 </tr>
60 <tr>
61 <td align=right>Password:</td>
62 - <td><input id=password {{{autocomplete}}}="current-password" type=password maxlength=256 name=password required /></td>
62 + <td><input id=password {{{autocomplete}}}="current-password" type=password maxlength=256 name=password required onchange=validateLogin(2) onkeyup=validateLogin(2,event) /></td>
63 </tr>
64 <tr>
65 <td><div id=showPassHintLink style=display:none><a onclick="return showPassHint(event);" href="#" style="cursor:pointer">Show Hint</a></div></td>
@@ -660,6 +660,14 @@
660 }
661 }
662
663 + function validateLogin(box, e) {
664 + setTimeout(function(){
665 + setDialogMode(0);
666 + 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(); } }
667 + if (e != null) { haltEvent(e); }
668 + }, 100);
669 + }
670 +
671 function validateCreate(box, e) {
672 setDialogMode(0);
673 var userok = false;
views/login2.handlebars
+13 -2
@@ -69,12 +69,12 @@
69 <table style="width:100%">
70 <tr>
71 <td>
72 - <input id=username title="Username" style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:8px;background-color:#FFF8CC" {{{autocomplete}}}="username" placeholder="Username" type=text maxlength=64 name=username required />
72 + <input id=username title="Username" style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:8px;background-color:#FFF8CC" {{{autocomplete}}}="username" placeholder="Username" type=text maxlength=64 name=username required onchange=validateLogin(1) onkeyup=validateLogin(1,event) />
73 </td>
74 </tr>
75 <tr>
76 <td>
77 - <input id=password title="Password" style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:8px;background-color:#FFF8CC" {{{autocomplete}}}="current-password" placeholder="Password" type=password maxlength=256 name=password required />
77 + <input id=password title="Password" style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:8px;background-color:#FFF8CC" {{{autocomplete}}}="current-password" placeholder="Password" type=password maxlength=256 name=password required onchange=validateLogin(2) onkeyup=validateLogin(2,event) />
78 </td>
79 </tr>
80 <tr>
@@ -771,6 +771,17 @@
771 if (!formSubmitted) { formSubmitted = true; document.getElementById(v).submit(); }
772 }
773
774 + function validateLogin(box, e) {
775 + setTimeout(function(){
776 + setDialogMode(0);
777 + if ((e != null) && (e.keyCode == 13)) {
778 + if ((box == 1) && (Q('username').value != '')) { Q('password').focus(); }
779 + else if ((box == 2) && (Q('password').value != '')) { Q('loginButton').click(); }
780 + }
781 + if (e != null) { haltEvent(e); }
782 + }, 100);
783 + }
784 +
785 function validateCreate(box, e) {
786 setDialogMode(0);
787 var userok = false;