Commit d4e9938e authored by Joshua Tauberer's avatar Joshua Tauberer

Merge pull request #533 from badsyntax/login-form-focus

Focus on fields in the login form
parents b2dfdc38 f26c0b71
......@@ -57,11 +57,15 @@ sudo tools/mail.py user make-admin me@{{hostname}}</pre>
<script>
function do_login() {
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;
}
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;
}
......@@ -126,4 +130,14 @@ function do_logout() {
sessionStorage.removeItem("miab-cp-credentials");
show_panel('login');
}
function show_login() {
$('#loginEmail,#loginPassword').each(function() {
var input = $(this);
if (!$.trim(input.val())) {
input.focus();
return false;
}
});
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment