{# Same shell and the same markup as auth's login form, so the two pages of the front door look like one site: shell('login') names the shell (AUTH_LOGIN_LAYOUT, else the application shell), and the classes are Bootstrap's names, which the admin shell styles natively and the public theme styles itself. Errors carry form-error (public theme) and text-danger (Bootstrap), so they read as errors in either. #} {% extends shell('login') %} {% block title %}{{ _('Sign up') }}{% if site is defined %} ยท {{ site.name }}{% endif %}{% endblock %} {% block content %}

{{ _('Sign up') }}

{% with messages = get_flashed_messages(with_categories=true) %} {% for category, message in messages %}
{{ message }}
{% endfor %} {% endwith %} {# External sign-in buttons (an identity provider, say), first, as the quick way in (UXA-47). Drawn only when one of them renders something, so a product without any shows no empty block. #} {% set providers = render_template_hooks("signup.providers") %} {% if providers %}

{{ _('Or sign up with your email address.') }}

{% endif %}
{{ form.hidden_tag() }} {# Every visible field of the form, in order, so the fields other features register (a profile's name, say) are asked for too. Each known field says what the browser may fill it with, and the password says what it has to be and can be shown (UXA-46). A field this page does not know keeps its own render_kw. #} {% set autocomplete = { 'name': 'given-name', 'surname': 'family-name', 'email': 'email', 'password': 'new-password', 'confirm_password': 'new-password', } %} {% for field in form if field.widget.input_type not in ('hidden', 'submit') %} {% set known = {} %} {% if field.short_name in autocomplete %} {% set known = {'autocomplete': autocomplete[field.short_name]} %} {% endif %} {% if field.short_name == 'email' %} {% set known = dict(known, type='email', spellcheck='false', autocapitalize='none') %} {% elif field.widget.input_type == 'password' %} {% set known = dict(known, **{'data-reveal': ''}) %} {% endif %} {% if field.widget.input_type == 'checkbox' %}
{{ field(class="form-check-input" ~ (" is-invalid" if field.errors else "")) }} {{ field.label(class="form-check-label") }} {% else %}
{{ field.label(class="form-label") }} {{ field(class="form-control" ~ (" is-invalid" if field.errors else ""), **known) }} {% endif %} {% if field.short_name == 'password' and password_requirements is defined %}

{{ password_requirements() }}

{% endif %} {% if field.description %}

{{ field.description }}

{% endif %} {% for error in field.errors %}

{{ error }}

{% endfor %}
{% endfor %} {# What another feature adds right above the button, such as a captcha widget. Its check listens to signup-submitting. #} {{ render_template_hooks("signup.form_fields") }} {{ form.submit(class="btn btn-primary mb-3") }}

{{ _('Already have an account?') }} {{ _('Log in') }}

{% for hook in get_template_hooks("signup.form_footer") %} {{ hook() | safe }} {% endfor %}
{% endblock %}