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

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

<form action="" method="POST" class="form" role="form">

    {{ form.hidden_tag() }}

    {# Username or Email field #}
    {% set field = form.username if user_manager.enable_username else form.email %}
    <div class="form-group">
        <label for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
        {{ field(class_='form-control'+(' is-invalid' if field.errors else ''), tabindex=110) }}
        {% if field.errors %}
            {% for e in field.errors %}
                <div class="invalid-feedback">{{ e }}</div>
            {% endfor %}
        {% endif %}
        {% if user_manager.enable_register and not user_manager.require_invitation %}
        <small class="form-text text-muted"><a href="{{ url_for('user.register') }}" tabindex='190'>{%trans%}New here? Register.{%endtrans%}</a></small>
        {% endif %}
    </div>

    {# Password field #}
    {% set field = form.password %}
    <div class="form-group">
        <label for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
        {{ field(class_='form-control'+(' is-invalid' if field.errors else ''), tabindex=120) }}
        {% if field.errors %}
            {% for e in field.errors %}
                <div class="invalid-feedback">{{ e }}</div>
            {% endfor %}
        {% endif %}
        {% if user_manager.enable_forgot_password %}
        <small class="form-text text-muted"><a href="{{ url_for('user.forgot_password') }}" tabindex='195'>{%trans%}Forgot your Password?{%endtrans%}</a></small>
        {% endif %}
    </div>

    {# Remember me #}
    {% if user_manager.enable_remember_me %}
    {{ render_checkbox_field(login_form.remember_me, tabindex=130) }}
    {% endif %}

    {# Submit button #}
    {{ render_submit_field(form.submit, tabindex=180) }}

</form>

{% endblock %}