Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in login validation #6434

Merged
merged 2 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions views/login-mobile.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
<table>
<tr>
<td id=loginusername align=right width=100>Username:</td>
<td><input id=username type=text autocomplete="username" maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event) /></td>
<td><input id=username type=text autocomplete="username" maxlength=64 name=username required /></td>
</tr>
<tr>
<td align=right>Password:</td>
<td><input id=password type=password autocomplete="current-password" maxlength=256 name=password autocomplete=off onchange=validateLogin(2) onkeyup=validateLogin(2,event) /></td>
<td><input id=password type=password autocomplete="current-password" maxlength=256 name=password autocomplete=off required /></td>
</tr>
<tr>
<td><div id=showPassHintLink style=display:none><a onclick=showPassHint() style="cursor:pointer">Show Hint</a></div></td>
<td align=right><input id=loginButton type=submit value="Log In" disabled="disabled" /></td>
<td align=right><input id=loginButton type=submit value="Log In" /></td>
</tr>
</table>
<div id="hrAccountDiv" style="display:none"><hr /></div>
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -818,4 +807,4 @@

</script>
</body>
</html>
</html>
19 changes: 4 additions & 15 deletions views/login.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
<table>
<tr>
<td id=loginusername align=right width=100>Username:</td>
<td><input id=username {{{autocomplete}}}="username" type=text maxlength=64 name=username onchange=validateLogin(1) onkeyup=validateLogin(1,event) /></td>
<td><input id=username {{{autocomplete}}}="username" type=text maxlength=64 name=username required /></td>
</tr>
<tr>
<td align=right>Password:</td>
<td><input id=password {{{autocomplete}}}="current-password" type=password maxlength=256 name=password onchange=validateLogin(2) onkeyup=validateLogin(2,event) /></td>
<td><input id=password {{{autocomplete}}}="current-password" type=password maxlength=256 name=password required /></td>
</tr>
<tr>
<td><div id=showPassHintLink style=display:none><a onclick="return showPassHint(event);" href="#" style="cursor:pointer">Show Hint</a></div></td>
<td align=right><input id=loginButton type=submit value="Log In" disabled="disabled" /></td>
<td align=right><input id=loginButton type=submit value="Log In" /></td>
</tr>
</table>
<div id="hrAccountDiv" style="display:none"><hr /></div>
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -971,4 +960,4 @@

</script>
</body>
</html>
</html>
22 changes: 4 additions & 18 deletions views/login2.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
<table style="width:100%">
<tr>
<td>
<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 onchange=validateLogin(1) onkeyup=validateLogin(1,event) />
<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 />
</td>
</tr>
<tr>
<td>
<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 onchange=validateLogin(2) onkeyup=validateLogin(2,event) />
<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 />
</td>
</tr>
<tr>
Expand All @@ -84,7 +84,7 @@
</tr>
<tr>
<td>
<input id=loginButton style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:6px" onclick="submitButtonClicked('loginpanelform')" type=button value="Log In" disabled="disabled" />
<input id=loginButton style="box-sizing:border-box;width:280px;border:0;border-radius:4px;padding:6px" onclick="submitButtonClicked('loginpanelform')" type=button value="Log In" />
</td>
</tr>
<tr id="topLanguageSelectRow" style="display:none"><td id="topLanguageSelect"></td></tr>
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1041,4 +1027,4 @@

</script>
</body>
</html>
</html>
Loading