45 lines
1.0 KiB
HTML
45 lines
1.0 KiB
HTML
<html>
|
|
<head>
|
|
<title>Login</title>
|
|
|
|
<style>
|
|
#invalidCredentials {
|
|
color: red;
|
|
}
|
|
</style>
|
|
|
|
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
|
|
<script src="http://malsup.github.com/jquery.form.js"></script>
|
|
|
|
<script>
|
|
// wait for the DOM to be loaded
|
|
$(document).ready(function() {
|
|
$('#invalidCredentials').hide();
|
|
// bind 'myForm' and provide a simple callback function
|
|
$('#loginForm').ajaxForm({
|
|
success: function() {
|
|
window.location.href = "/api/v1/restricted";
|
|
},
|
|
error: function() {
|
|
$('#invalidCredentials').show();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<form id="loginForm" action="/api/v1/login" method="POST">
|
|
<label for="username">User</label>
|
|
<input type="text" name="username" /><br />
|
|
|
|
<label for="password">Password</label>
|
|
<input type="password" name="password" /><br />
|
|
|
|
<div id="invalidCredentials">
|
|
The entered credentials are invalid
|
|
</div>
|
|
|
|
<input type="submit" value="Login"/>
|
|
</form>
|
|
</body>
|
|
</html> |