{{ moduleHeader('user', 'New account registration'|trans, '', true, true) }}

<p id="users_formtop">
    {% trans %}Registering for a user account is easy. Registration can give you access to content and to features of this site that are not available to unregistered guests.{% endtrans %}
    {% trans %}During your visits, we recommended that you set your browser to accept cookies from this site. Various features of the site use cookies, and may not function properly (or may not function at all) if cookies are disabled.{% endtrans %}
</p>

{% if getModVar('ZikulaZAuthModule', constant('Zikula\\ZAuthModule\\ZAuthConstant::MODVAR_EMAIL_VERIFICATION_REQUIRED')) %}
    <p class="alert alert-info">{% trans %}Before you will be able to log in, you must verify your e-mail address. You will receive an e-mail asking to verify your e-mail address after submitting the information below.{% endtrans %}
{% elseif getModVar('ZikulaUsersModule', constant('Zikula\\UsersModule\\Constant::MODVAR_REGISTRATION_APPROVAL_REQUIRED')) %}
    <p class="alert alert-info">{% trans %}Before you will be able to log in, an administrator must approve your registration request. You will receive an e-mail after an administrator has reviewed the information you submit below.{% endtrans %}</p>
{% endif %}

<p class="alert alert-warning">{% trans %}The items that are marked with an asterisk (*) are required entries.{% endtrans %}</p>
{{ form_start(form) }}
{{ form_errors(form) }}
    <input id="{{ form.vars.id }}_event_type" type="hidden" name="event_type" value="new_registration" />
    <input id="{{ form.vars.id }}_registration_info" type="hidden" name="registration_info" value="1" />
    <fieldset>
        <legend>{% trans %}Choose a user name{% endtrans %}</legend>
        {{ form_row(form.uname) }}
        <div class="form-group row">
            <small class="form-text text-muted col-md-9 offset-md-3">{% trans %}Your user name is used to identify you to other users on the site. You still need to set one up, even though you will not be using it to log in.{% endtrans %}</small>
        </div>
    </fieldset>
    {% if form.children.email is defined %}{# email may not be defined if authentication is non-local #}
        <fieldset>
            <legend>{% trans %}Enter your e-mail address{% endtrans %}</legend>
            {{ form_row(form.email) }}
        </fieldset>
    {% endif %}
    <fieldset>
        <legend>{% trans %}Set a password{% endtrans %}</legend>
        {{ include('@ZikulaZAuthModule/Authentication/PasswordGenerator.html.twig') }}
        {{ form_row(form.pass) }}
    </fieldset>

    {% for template in additionalTemplates %}
        {{ include(template.view, template.params, ignore_missing = true) }}
    {% endfor %}

    {{ notifyDisplayHooks(constant('Zikula\\UsersModule\\HookSubscriber\\RegistrationUiHooksSubscriber::REGISTRATION_FORM')) }}

    {% if getModVar('ZikulaZAuthModule', constant('Zikula\\ZAuthModule\\ZAuthConstant::MODVAR_REGISTRATION_ANTISPAM_QUESTION')) is not empty %}
    <fieldset>
        <legend>{% trans %}Answer the security question{% endtrans %}</legend>
        {{ form_row(form.antispamanswer) }}
    </fieldset>
    {% endif %}
    <div class="form-group row">
        <div class="col-md-9 offset-md-3">
            {{ form_widget(form.submit) }}
            {{ form_widget(form.cancel) }}
            {{ form_widget(form.reset) }}
        </div>
    </div>
{{ form_end(form) }}
{% if getModVar('ZikulaZAuthModule', constant('Zikula\\ZAuthModule\\ZAuthConstant::MODVAR_PASSWORD_STRENGTH_METER_ENABLED')) %}
    {{ pageAddAsset('javascript', zasset('@ZikulaZAuthModule:js/pwstrength-bootstrap.min.js')) }}
    {{ pageAddAsset('javascript', zasset('@ZikulaZAuthModule:js/Zikula.ZAuth.PWStrength.Init.js')) }}
{% endif %}
