HAL: Use submit button in login form

This enables some automatic features of the browsers, f.e. the form will be
submitted when you press the return key in the username or password field.
This commit is contained in:
Alexander Sulfrian
2019-05-24 18:53:10 +02:00
parent 2111d03ffb
commit 812b459cf5

View File

@@ -55,11 +55,11 @@
</head>
<body>
<div class="container">
<form class="form-signin">
<form id="login-form" class="form-signin">
<h2 class="form-signin-heading">HAL Browser</h2>
<input type="text" class="input-block-level" placeholder="Username" id="username">
<input type="password" class="input-block-level" placeholder="Password" id="password">
<button type="button" class="btn btn-large btn-primary" id="login">Sign in</button>
<button type="submit" class="btn btn-large btn-primary" id="login">Sign in</button>
<div class="other-login-methods hidden">
<h3>Other login methods:</h3>
@@ -133,7 +133,7 @@
return string.charAt(0).toUpperCase() + string.slice(1);
}
$("#login").click(function() {
$("#login-form").submit(function() {
$.ajax({
//This depends on this file to be called login.html
url : window.location.href.replace("login.html", "") + 'api/authn/login',
@@ -149,6 +149,8 @@
toastr.error('The credentials you entered are invalid. Please try again.', 'Login Failed');
}
});
return false;
});
});
</script>