mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-05-09 16:04:46 +00:00
switched crypto to crypto-js from google. login.html form loads crypto-js directly from google codebase in order to hash passwords before sending them to the server
31 lines
No EOL
1.1 KiB
HTML
31 lines
No EOL
1.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Login</title>
|
|
<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" /></td></tr>
|
|
<tr><td>password: </td><td><input type="password" id="password" /></td></tr>
|
|
</table>
|
|
<button id="but_submit">login</button>
|
|
</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> |