{% extends 'appearance/base_plain.html' %}

{% load i18n %}
{% load static %}

{% load appearance_tags %}
{% load common_tags %}
{% load smart_settings_tags %}

{% block base_title %}{% trans 'Login' %}{% endblock %}

{% block project_name %}{% endblock %}

{% block content_plain %}
    {% appearance_app_templates template_name='login_content' %}

    <div class="row">
        <div class="col-xs-10 col-xs-offset-1 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title">{% trans 'Sign in' %}</h3>
                </div>
                <div class="panel-body">
                    <div class="content login">
                        <form action="." method="post" class="form login">
                            {% csrf_token %}
                            <div class="group wat-cf">
                                {{ wizard.management_form }}

                                {% if wizard.form.forms %}
                                    {{ wizard.form.management_form }}

                                    {% with wizard.form as form %}
                                    {% with 'true' as form_display_mode_table %}
                                        {% include 'appearance/generic_form_instance.html' %}
                                    {% endwith %}
                                    {% endwith %}
                                {% else %}
                                    {% if wizard.form %}
                                        {% with wizard.form as form %}
                                            {% include 'appearance/generic_form_instance.html' %}
                                        {% endwith %}
                                    {% else %}
                                        {% include 'appearance/generic_form_instance.html' %}
                                    {% endif %}
                                {% endif %}

                                <input type="hidden" name="next" value="{{ next|escape }}" />

                                <div class="form-group">
                                    <button class="btn btn-primary btn-hotkey-default" name="{% if form.prefix %}{{ form.prefix }}-submit{% else %}submit{% endif %}" type="submit">
                                        {% if submit_icon %}
                                            {{ submit_icon.render }}
                                        {% else %}
                                            <i class="fa fa-check"></i>
                                        {% endif %}
                                        {% if submit_label %}{{ submit_label }}{% else %}{% if form.instance %}{% trans 'Save' %}{% else %}{% trans 'Submit' %}{% endif %}{% endif %}
                                    </button>
                                </div>
                            </div>
                        </form>

                        {% smart_setting global_name="AUTHENTICATION_DISABLE_PASSWORD_RESET" as setting_disable_password_reset %}
                        {% if not setting_disable_password_reset %}
                            <hr>
                            <div>
                                <a class="pull-right" href="{% url 'authentication:password_reset_view' %}">{% trans 'Forgot your password?' %}</a>
                            </div>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}
