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

{% block content %}
{% from "flask_user/_macros.html" import render_field, render_submit_field %}
<h1>{%trans%}Register{%endtrans%}</h1>
<p>&nbsp;</p>

<strong>Your username MUST be your callsign.</strong> After filling out the fields, a confirmation link may be emailed to you.
<hr />
<p>&nbsp;</p>
By registering, you acknowledge that you agree to the Terms of Use.
<p>&nbsp;</p>

<p style="text-align: center;"><a href="/tos"><button type="button" class="btn btn-primary">Terms of Use</button></a></p>
<p>&nbsp;</p>
<hr />
<p>&nbsp;</p>

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

    {# Username or Email #}
    {% 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, "Already registered? Sign in." 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 %}
                    <a href="{{ url_for('user.login') }}" tabindex='290'>
                        {%trans%}Already registered? Sign in.{%endtrans%}</a>
                {% endif %}
            </div>
        </div>
        
        {{ field(class_='form-control', tabindex=210) }}
        {% if field.errors %}
            {% for e in field.errors %}
                &nbsp;

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

    {% if user_manager.USER_ENABLE_EMAIL and user_manager.USER_ENABLE_USERNAME %}
        {{ render_field(form.email, tabindex=220) }}
        &nbsp;
    {% endif %}

    {{ render_field(form.password, tabindex=230) }}

    {% if user_manager.USER_REQUIRE_RETYPE_PASSWORD %}
        {{ render_field(form.retype_password, tabindex=240) }}
    {% endif %}
        
    {{ render_submit_field(form.submit, tabindex=280) }}
</form>

<p>&nbsp;</p>


{% endblock %}
