{% extends "pylucid/css_anchor_div.html" %}


{% block plugin_content %}

{# We can't use extrahead block here, because it's used in ajax view, too. #}
{% compress css %}
<style type="text/css">
#login_form, #sha_values_block, #js_page_msg { display: none; }
#js_page_msg { padding: 0.5em; }
.page_msg_success { color: #000000; border: 1px solid #00ff00; }
.page_msg_error { color: #ff0000; border: 1px solid #ff0000; }
.page_msg_info { color: #0000ff; border: 1px solid #000000; }
</style>
{% endcompress %}

<script type="text/javascript" src="{% url django.views.i18n.javascript_catalog packages="auth" %}"></script>
{% compress js %}
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/auth/sha.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/auth/shared_sha_tools.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript">
var SALT_LEN=parseInt("{{ salt_len }}");
var HASH_LEN=parseInt("{{ hash_len }}");
var challenge="{{ challenge }}"; // changed via ajax, after wrong login
var salt=""; // get via ajax
var next_url="{{ next_url }}";
var sha_auth_url="{{ sha_auth_url }}";
var get_salt_url="{{ get_salt_url }}";
</script>
<script type="text/javascript" src="{{ STATIC_URL }}PyLucid/auth/sha_login.js" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
{% endcompress %}

<fieldset>
<legend>
	PyLucid <a href="http://www.pylucid.org/permalink/42/secure-login-without-https" title="{% trans "What is the PyLucid JS-SHA-LogIn?" %}">JS-SHA-LogIn</a>
</legend>

<noscript>
    <fieldset id="js_error"><legend>{% trans 'Error' %}</legend>
    <h3>Error: For the JS-SHA-Login is Javascript needed!</h3>
    <p>Without JavaScript, you can only use the unsecure plaintext login!</p>
    </fieldset>
</noscript>

<p id="load_info">{% trans "loading..." %}</p>

<form method="post" action="" name="login" id="login_form" autocomplete="on">
  <p id="js_page_msg"></p>
  <p>
  	<label for="id_username">{% trans "Username" %}:</label>
    <input id="id_username" type="text" name="username" maxlength="30" required="required" autocomplete="on" />
  </p>
  <p id="password_block">
  	<label for="id_password">{% trans "Password" %}:</label>
	<input id="id_password" type="password" name="password" maxlength="128" required="required" autocomplete="off" />
  </p>
  <p id="sha_values_block">
  	<label>SHA values:</label>
    <input readonly="readonly" name="sha_a2" maxlength="40" type="text" id="id_sha_a2" size="40" autocomplete="off" />
    <input readonly="readonly" name="sha_b" maxlength="20" type="text" id="id_sha_b" size="20" autocomplete="off" />
  </p>
  <input id="submit_button" type="submit" value="{% trans 'Log in' %}" />
</form>
{% comment %}
TODO: Reimplement the passwort reset
{% if pass_reset_link %}
  <a href="{{ pass_reset_link }}">{% trans 'Request a password reset.' %}</a>
{% endif %}
{% endcomment %}
</fieldset>
{% endblock %}