1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

Focus on fields in the login form

This just makes life a little easier...

Squashed the following commits:

* Use $.trim() for better browser support
This commit is contained in:
Richard Willis 2015-08-27 22:06:14 +02:00
parent b2dfdc386a
commit f26c0b71d2

View File

@ -57,11 +57,15 @@ sudo tools/mail.py user make-admin me@{{hostname}}</pre>
<script> <script>
function do_login() { function do_login() {
if ($('#loginEmail').val() == "") { if ($('#loginEmail').val() == "") {
show_modal_error("Login Failed", "Enter your email address.") show_modal_error("Login Failed", "Enter your email address.", function() {
$('#loginEmail').focus();
});
return false; return false;
} }
if ($('#loginPassword').val() == "") { if ($('#loginPassword').val() == "") {
show_modal_error("Login Failed", "Enter your email password.") show_modal_error("Login Failed", "Enter your email password.", function() {
$('#loginPassword').focus();
});
return false; return false;
} }
@ -126,4 +130,14 @@ function do_logout() {
sessionStorage.removeItem("miab-cp-credentials"); sessionStorage.removeItem("miab-cp-credentials");
show_panel('login'); show_panel('login');
} }
function show_login() {
$('#loginEmail,#loginPassword').each(function() {
var input = $(this);
if (!$.trim(input.val())) {
input.focus();
return false;
}
});
}
</script> </script>