{% extends "admin/base_site.html" %}
{% load i18n static %}

{% block content_title %}<a href="https://github.com/jedie/django-secure-js-login">Secure-JS-Login:</a>{% endblock %}

{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/login.css' %}" />
<style>
form {
    /* acticated via JavaScript */
    display:none;
}
</style>
<script type="text/javascript">
var DEBUG={{ DEBUG }};
var challenge="{{ challenge }}";
var CHALLENGE_LENGTH={{ CHALLENGE_LENGTH }};
var NONCE_LENGTH={{ NONCE_LENGTH }};
var SALT_LENGTH={{ SALT_LENGTH }};
var PBKDF2_BYTE_LENGTH={{ PBKDF2_BYTE_LENGTH }};
var ITERATIONS1={{ ITERATIONS1 }};
var ITERATIONS2={{ ITERATIONS2 }};
var CSRF_COOKIE_NAME="{{ CSRF_COOKIE_NAME }}";

var get_salt_url="{% url 'secure-js-login:get_salt' %}";
</script>
<script type="text/javascript" src="{% static 'admin/js/jquery.min.js' %}" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript" src="{% url 'django.views.i18n.javascript_catalog' packages='auth' %}" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript" src="{% static 'secure_js_login/secure_js_login.js' %}" onerror="JavaScript:alert('Error loading file ['+this.src+'] !');"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
    init_secure_login();
});
</script>
{% endblock extrahead %}

{% block bodyclass %}{{ block.super }} login{% endblock %}

{% block content %}{{ block.super }}
<div id="content-main">
    <noscript><p class="errornote">Please enable JavaScript!</p></noscript>
    <div id="js_page_msg" style="display:none"></div>
    <form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
        <table>
        {{ form.as_table }}
        {% url 'admin_password_reset' as password_reset_url %}
        {% if password_reset_url %}
        <tr>
            <td>
                <div class="password-reset-link">
                    <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
                </div>
            </td>
        </tr>
        {% endif %}
        <tr>
            <th></th>
            <td><input type="submit" value="{% trans 'Log in' %}"/></td>
        </tr>
        </table>
    </form>
</div>
{% endblock content %}