{% 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>
<p>&nbsp;</p>

<strong>Your username MUST be your callsign or email address.</strong>
<p>&nbsp;</p>

<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 on left, "New here? Register." on right #}
        <div class="row">
            <div class="col-xs-6">
                <label for="{{ field.id }}" class="control-label"><strong>{{ field.label.text }}</strong></label>
            </div>
            <div class="col-xs-6 text-right">
                {% 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 %}
            </div>
        </div>
        {{ field(class_='form-control', tabindex=110) }}
        {% if field.errors %}
            {% for e in field.errors %}
                &nbsp;

                <p class="help-block"><strong>{{ e }}</strong></p>
            {% endfor %}
        {% endif %}
    </div>
        &nbsp;

    {# Password field #}
    {% set field = form.password %}
    <div class="form-group {% if field.errors %}has-error{% endif %}">
        {# Label on left, "Forgot your Password?" on right #}
        <div class="row">
            <div class="col-xs-6">
                <label for="{{ field.id }}" class="control-label"><strong>{{ field.label.text }}</strong></label>
            </div>
            <div class="col-xs-6 text-right">
                {% if user_manager.USER_ENABLE_FORGOT_PASSWORD %}
                    <a href="{{ url_for('user.forgot_password') }}" tabindex='195'>
                        {%trans%}Forgot your Password?{%endtrans%}</a>
                {% endif %}
            </div>
        </div>
        {{ field(class_='form-control', tabindex=120) }}
        {% if field.errors %}
            {% for e in field.errors %}
        &nbsp;

                <p class="help-block"><strong>{{ e }}</strong></p>
            {% endfor %}
        {% endif %}
    </div>
&nbsp;
    {# Remember me #}
    {% if user_manager.USER_ENABLE_REMEMBER_ME %}
    {{ render_checkbox_field(login_form.remember_me, tabindex=130) }}
    {% endif %}

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

{% endblock %}
