{% extends "trionyx/base.html" %}
{% load i18n static %}

{% block body_class %}login-page{% endblock %}
{% block title %}{% trans "Sign In" %}{% endblock %}

{% block body %}
    <div class="login-box">
        {% block logo %}
        <div class="login-logo">
            {# Mirrors block names used in _main_header.html #}
            {% block logo_text %}<b>{{ TX_LOGO_NAME_START }}</b>{{ TX_LOGO_NAME_END }}{% endblock %}
        </div>
        {% endblock %}
        <!-- /.login-logo -->
        <div class="login-box-body">
            {% if form.non_field_errors %}
                {% for error in form.non_field_errors %}
                    <p class="alert alert-danger">
                        {{ error }}
                    </p>
                {% endfor %}
            {% endif %}

            {% block login_form %}
                <form action="" method="post">
                    {% csrf_token %}
                    {% if message %}
                        <p class="login-box-msg" style="color: red;">{{ message }}</p>
                    {% endif %}

                    <div class="form-group has-feedback {% if form.username.errors %}has-error{% endif %}">
                        <input type="email" name="username" class="form-control" placeholder="{% trans "Email" %}" value="{% if form.username.value %}{{form.username.value}}{% endif %}">
                        <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
                        {% for error in form.username.errors %}
                            <span class="help-block">{{ error }}</span>
                        {% endfor %}
                    </div>

                    <div class="form-group has-feedback {% if form.password.errors %}has-error{% endif %}">
                        <input type="password" name="password" class="form-control" placeholder="{% trans "Password" %}">
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                        {% for error in form.password.errors %}
                            <span class="help-block">{{ error }}</span>
                        {% endfor %}
                    </div>

                    <div class="row">
                        <div class="col-xs-12">
                            <button type="submit" class="btn bg-theme btn-block btn-flat">{% trans "Sign in" %}</button>
                        </div>
                    </div>
                </form>
            {% endblock login_form %}

        </div>
    </div>
{% endblock %}