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

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

<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 for="{{ field.id }}" class="control-label">{{ field.label.text }}</label>
        {{ field(class_='form-control', tabindex=210) }}
        {% if field.errors %}
            {% for e in field.errors %}
                <p class="text-c-red">{{ e }}</p>
            {% endfor %}
        {% endif %}
    </div>

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

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

    {% if user_manager.USER_REQUIRE_RETYPE_PASSWORD %}
        {{ render_field(form.retype_password, tabindex=240) }}
    {% endif %}

    <div class="form-group">
        {{ render_submit_field(form.submit, tabindex=280) }}
        {% if user_manager.USER_ENABLE_REGISTER %}
            <a href="{{ url_for('user.login') }}" tabindex='290' style="margin-left: 15px;">
                {%trans%}Already registered? Sign in.{%endtrans%}</a>
        {% endif %}
    </div>
</form>

{% endblock %}