{# The invitation acceptation page.

This page is displayed to users who have clicked on invitation links sent by mail (or by other media).
It displays a basic account creation form.

:param form: The account creation form.
:type form: :class:`~canaille.core.endpoints.forms.JoinForm`
#}
{% extends theme('base.html') %}
{% import 'macro/form.html' as fui %}
{% import 'core/partial/profile_field.html' as profile %}

{%- block title -%}
    {%- trans %}User creation{% endtrans -%}
{%- endblock -%}

{% block content %}
    <div class="joinform">
        <h2 class="ui top attached header">
            {% if logo_url %}
                <img class="ui image" src="{{ logo_url }}">
            {% endif %}

            <div class="content">
                {% trans %}User creation{% endtrans %}
                <div class="sub header">
                    {% trans %}Create a new user account{% endtrans %}
                </div>
            </div>
        </h2>
        <div class="ui attached message">
            {% trans %}
                Before you can create an account, please enter a valid email address.
                Then you will receive an email containing a link that will allow you to
                finish your registration.
            {% endtrans %}
        </div>
        <div class="ui attached clearing segment">

            {% call fui.render_form(form, class_="profile-form info") %}
                {% if "email" in form %}
                    {{ profile.render_field(form.email) }}
                {% endif %}

                <div class="ui right aligned container">
                    <div class="ui stackable buttons">
                        <a type="button" class="ui right floated button" href="{{ url_for('core.auth.login') }}">{{ _("Login page") }}</a>
                        {% if features.has_smtp and features.has_password_recovery %}
                            <a type="button" class="ui right floated button" href="{{ url_for('core.auth.password.forgotten') }}">{{ _("Forgotten password") }}</a>
                        {% endif %}
                        <button type="submit" class="ui right floated primary button" name="action" value="create-profile" id="create-profile">
                            {{ _("Submit") }}
                        </button>
                    </div>
                </div>

            {% endcall %}
        </div>
{% endblock %}
