{% extends 'flask_user/_public_base.html' %}

{% block content %}
{% from "flask_user/_macros.html" import render_field, render_checkbox_field, render_submit_field %}
<h6>{%trans%}Sign in{%endtrans%}</h6>

<form action="" method="POST" class="form" role="form">
    {{ form.hidden_tag() }}

    {# Username or Email field #}
    {% set field = form.username if user_manager.USER_ENABLE_USERNAME else form.email %}
    <div class="form-group {% if field.errors %}has-error{% endif %}">
        <label for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
        {{ field(class_='form-control', tabindex=110) }}
        {% if field.errors %}
            {% for e in field.errors %}
                <p class="text-c-red">{{ e }}</p>
            {% endfor %}
        {% endif %}
    </div>
    {# Password field #}
    {% set field = form.password %}
    <div class="form-group {% if field.errors %}has-error{% endif %}">
        <label for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
        {{ field(class_='form-control', tabindex=120) }}
        {% if field.errors %}
            {% for e in field.errors %}
                <p class="text-c-red">{{ e }}</p>
            {% endfor %}
        {% endif %}
    </div>
    <div class="text-right mb-2">
        {% if user_manager.USER_ENABLE_REGISTER and not user_manager.USER_REQUIRE_INVITATION %}
            <a href="{{ url_for('user.register') }}" tabindex='190'>
                {%trans%}New here? Register.{%endtrans%}</a>
        {% endif %}
        {% if user_manager.USER_ENABLE_FORGOT_PASSWORD %}
            {% if user_manager.USER_ENABLE_REGISTER and not user_manager.USER_REQUIRE_INVITATION %}<span style="margin: 0 10px;">|</span>{% endif %}
            <a href="{{ url_for('user.forgot_password') }}" tabindex='195'>
                {%trans%}Forgot your Password?{%endtrans%}</a>
        {% endif %}
    </div>
    <div class="form-group">
        {{ render_submit_field(form.submit, tabindex=180) }}
        {% if user_manager.USER_ENABLE_REMEMBER_ME %}
            <label style="margin-left: 15px;">
                {{ form.remember_me() }} Remember Me
            </label>
        {% endif %}
    </div>
</form>

{% endblock %}