Dynastie/templates/login.html

58 lines
1.7 KiB
HTML
Raw Normal View History

2012-07-08 16:23:39 +02:00
<html>
<head>
<title>Dynastie</title>
<script type="text/javascript" src="{{ STATIC_URL }}js/jsaes.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/sha256.js"/></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/base64.js"/></script>
<script type="text/javascript" language="javascript">
<!--
function encryptPassword()
{
var password = "{{ auth_key }};
var plaintext = Sha256.hash(document.getElementById("password").value, false);
//AES_Init();
//AES_ExpandKey(password);
//AES_Encrypt(plaintext, password);
document.getElementById("password").value = Base64.encode(plaintext);
//AES_Done();
document.forms[0].submit();
}
//-->
</script>
<style type="text/css">
div.logo {
margin-top:2%;
margin-bottom:5%;
margin-left:auto;
margin-right:auto;
text-align:center;
}
div.form {
margin-left:40%;
}
#login_failed {
color:red;
font-weight:bold;
}
</style>
</head>
<body>
<div class="logo">
<img src="{{ STATIC_URL }}images/logo.png"/>
</div>
<div class="form">
<form method="post" action="/index" onSubmit="encryptPassword()">
{% csrf_token %}
{% if login_failed %} <p id="login_failed">Login or password is invalid</p> {% endif %}
<table>
<tr><td>Login</td><td><input type="text" name="login"/></td></tr>
<tr><td>Password</td><td><input id="password" type="password" name="password"/></td></tr>
<tr><td/><td><input type="submit" value="Connect"/></td></tr>
</table>
</form>
</div>
</body>
</html>