{% load bootstrap4 %}
{% load compress %}
{% load i18n %}
{% load static %}

{% bootstrap_form_errors form %}
{% if no_form %}
    <div id="auth-form" class="password-input-form d-md-flex flex-row">
{% else %}
    <form id="auth-form" class="password-input-form d-md-flex flex-row" method="post" autocomplete="off">
{% endif %}
{% csrf_token %}
{% compress js %}
    <script defer src="{% static 'common/js/zxcvbn.js' %}"></script>
    <script defer src="{% static 'common/js/password_strength.js' %}"></script>
{% endcompress %}
{% if not hide_login %}
    <div class="auth-form-block flex-grow-1">
        {% if not hide_login and not hide_register %}
            <h4 class="text-center">{% translate "I already have an account" %}</h4>
        {% endif %}
        {% bootstrap_field form.login_email layout="inline" %}
        {% bootstrap_field form.login_password layout="inline" %}
        {% if not no_buttons %}
            <button type="submit" class="btn btn-lg btn-success btn-block">
                {% translate "Log in" %}
            </button>
        {% endif %}
        {% if password_reset_link or request.event %}
            <a class="btn btn-block btn-link" href="{% if password_reset_link %}{{ password_reset_link }}{% else %}{{ request.event.urls.reset }}{% endif %}">
                {% translate "Reset password" %}
            </a>
        {% endif %}
    </div>
{% endif %}
{% if not hide_register %}
    <div class="auth-form-block flex-grow-1">
        {% if not hide_login and not hide_register %}
            <h4 class="text-center">{% translate "I need a new account" %}</h4>
        {% endif %}
        {% bootstrap_field form.register_name layout="inline" %}
        {% bootstrap_field form.register_email layout="inline" %}
        {% bootstrap_field form.register_password layout="inline" %}
        {% bootstrap_field form.register_password_repeat layout="inline" %}
        {% if not no_buttons %}
            <button type="submit" class="btn btn-lg btn-info btn-block">
                {% translate "Register" %}
            </button>
        {% endif %}
    </div>
{% endif %}
{% if no_form %}</div>{% else %}</form>{% endif %}
