{% extends "registration/base.html" %}
{% load vst_html_tags %}

{% block bodyclass %}register-page{% endblock %}
{% block login_body_content %}
    {% if uid %}
        <script>
            const uid = '{{uid | safe}}';
            const form = document.createElement("form");
            const uidInput = document.createElement("input");
            const csrfInput = document.createElement("input")
            form.method = "POST";
            form.action = document.location.href.replace(document.location.search, '');
            uidInput.value = uid;
            uidInput.name = "uid";
            uidInput.type = "hidden";
            csrfInput.value = document.cookie.match(/csrftoken=(.+?)(;|$)/)[1];
            csrfInput.name = "csrfmiddlewaretoken";
            csrfInput.type = "hidden";
            form.appendChild(uidInput);
            form.appendChild(csrfInput);
            document.body.appendChild(form);
            form.submit();
        </script>
    {% endif %}
    <div class="login-box password-reset">
        {% if form.errors.uid %}
            {% translate_errors form.uid.errors %}
        {% endif %}
        <form method="post">
            {% csrf_token %}

            {% block base_registration_fields %}
                {% bootstrap_form form %}
            {% endblock %}

            {% block additional_registration_fields %}
            {% endblock %}
            <div style="text-align: center; clear: both">
                <input type="submit" value="{% translate_text "register" capfirst %}" class="btn btn-primary">
            </div>
        </form>
    </div>
{% endblock %}

{% block after_content %}
    {% block registration_confirmation_script %}
    {% endblock %}
{% endblock %}
