{#
    Copyright (c) 2015 Chintalagiri Shashank
    Released under the MIT license
#}

{% extends 'base_templates/base.html' %}

{% block main %}
{% from "base_templates/form_macros.html" import render_field, render_checkbox_field, render_submit_field %}
<div class="row"> <p></p></div>
<div class="row">

    <div class="small-11 large-5 columns">
        <div class="panel radius">
            <h1>{%trans%}Sign in{%endtrans%}</h1>

            {# ** Login form ** #}
            <form action="{{ url_for('user.login') }}" method="POST" class="form" role="form">
                {{ login_form.hidden_tag() }}

                {# Username or Email #}
                {% set field = login_form.username if user_manager.enable_username else login_form.email %}
                {{ render_field(field, tabindex=10) }}

                {# Password #}
                {{ render_field(login_form.password, tabindex=20) }}

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

                {# Submit button #}
                {{ render_submit_field(login_form.submit, tabindex=40) }}
            </form>
            {% if user_manager.enable_forgot_password %}
                <p>
                    <br/>
                    <a href="{{ url_for('user.forgot_password') }}" tabindex='50'>
                    {%trans%}Forgot your Password?{%endtrans%}</a>
                </p>
            {% endif %}
        </div>
    </div>
    <div class="small-1 columns"><p></p></div>
    <div class="small-12 large-6 columns">
        <div class="panel radius">
            <h1>{%trans%}Register{%endtrans%}</h1>

            {# ** Register form ** #}
            <form action="{{ url_for('user.register') }}" method="POST" novalidate formnovalidate class="form" role="form">
                {{ register_form.hidden_tag() }}

                {{ render_field(register_form.full_name, tabindex=60) }}

                {# Username or Email #}
                {% set field = register_form.username if user_manager.enable_username else register_form.email %}
                {{ render_field(field, tabindex=70) }}

                {% if user_manager.enable_email and user_manager.enable_username %}
                    {{ render_field(register_form.email, tabindex=80) }}
                {% endif %}


                {{ render_field(register_form.password, tabindex=90) }}

                {% if user_manager.enable_retype_password %}
                    {{ render_field(register_form.retype_password, tabindex=100) }}
                {% endif %}

                {{ render_submit_field(register_form.submit, tabindex=110) }}
            </form>
        </div>
    </div>

</div>
{% endblock %}
