webapi-eca/webpages/handlers/login.html
2014-02-10 22:28:10 +01:00

34 lines
No EOL
1.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Login</title>
{{{head_requires}}}
<!-- <link rel="stylesheet" type="text/css" href="style.css">
<script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/sha3.js"></script>
-->
</head>
<body>
<div id="mainbody">
<div id="pagetitle">Login</div>
<table>
<tr><td>username: </td><td><input type="text" id="username" autofocus /></td></tr>
<tr><td>password: </td><td><input type="password" id="password" /></td></tr>
</table>
<button id="but_submit">login</button>
</div>
<div id="info"></div>
<script>
$('#but_submit').click(function() {
var hashedPassword = (CryptoJS.SHA3($('#password').val(), { outputLength: 512 })).toString();
$.post('/login', { username: $('#username').val(), password: hashedPassword })
.done(function(data) {
window.location.href = document.URL;
})
.fail(function(err) {
alert('Authentication not successful!');
});
});
</script>
</body>
</html>