<!--
SPDX-FileCopyrightText: 2019-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% load html_signal %}
{% load i18n %}

{% include "common/forms/errors.html" %}
{% 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 %}

{% if not hide_login %}
    <div class="auth-form-block">
        {% if not hide_login and not hide_register %}
            <h4 class="text-center">{% translate "I already have an account" %}</h4>
        {% endif %}
        {{ form.login_email.as_field_group }}
        {{ form.login_password.as_field_group }}
        {% 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 %}">
                {{ phrases.base.password_reset_heading }}
            </a>
        {% endif %}
        {% html_signal "pretalx.common.signals.auth_html" sender=request.event request=request next_url=success_url %}
    </div>
{% endif %}
{% if not hide_register %}
    <div class="auth-form-block">
        {% if not hide_login and not hide_register %}
            <h4 class="text-center">{% translate "I need a new account" %}</h4>
        {% endif %}
        {{ form.register_name.as_field_group }}
        {{ form.register_email.as_field_group }}
        {{ form.register_password.as_field_group }}
        {{ form.register_password_repeat.as_field_group }}
        {% 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 %}
