{% extends "brillixy/base.html" %}
{% load i18n %}

{% block extrastyle %}
    <link href="{{ STATIC_URL }}brillixy/css/login.css" rel="stylesheet" type="text/css" />
{% endblock %}

{% block breadcrumbs %}{% endblock %}

{% block content_title %}{% endblock %}

{% block content %}
<div class="row">
    <div class="span7 well">
        {% block content-well %}
        <h1>{{ title }}</h1>

        {% if form.non_field_errors or form.this_is_the_login_form.errors %}
        <div class="alert alert-error">
            {% for error in form.non_field_errors|add:form.this_is_the_login_form.errors %}
            <p class="errornote">
                {{ error }}
            </p>
            {% endfor %}
        </div>
        {% endif %}

        <div id="content-main">
            <form action="{{ app_path }}" method="post" class="form-horizontal" id="login-form">
                <!-- Hidden -->
                {% csrf_token %}
                <input type="hidden" name="this_is_the_login_form" value="1" />
                <input type="hidden" name="next" value="{{ next }}" />

                <div class="control-group">
                    <label for="id_username" class="control-label">{{ form.username.label }}:</label>
                    <div class="controls">
                        {% if not form.this_is_the_login_form.errors %}{{ form.username.errors }}{% endif %}
                        {{ form.username }}
                    </div>
                </div>

                <div class="control-group">
                    <label for="id_password" class="control-label">{% trans 'Password:' %}</label>
                    <div class="controls">
                        {% if not form.this_is_the_login_form.errors %}{{ form.password.errors }}{% endif %}
                        {{ form.password }}
                    </div>
                </div>

                {% url 'admin_password_reset' as password_reset_url %}
                
                <div class="control-group submit-row">
                    <div class="controls">
                        <button type="submit" class="btn btn-large btn-primary"><i class="icon-ok"></i> {% trans 'Log in' %}</button>

                        {% if not password_reset_url %}
                        <p class="password-reset-link">
                            <a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
                        </p>
                        {% endif %}
                    </div>
                </div>
            </form>

            <script type="text/javascript">
                document.getElementById('id_username').focus()
            </script>
        </div>
        {% endblock %}
    </div>
</div>
{% endblock %}