<h3>
    <span class="fas fa-upload"></span>
    {% trans %}Import users{% endtrans %}
    {{ pageSetVar('title', 'Import users'|trans) }}
</h3>

{{ form_start(form) }}
{{ form_errors(form) }}
<fieldset>
    <legend>{% trans %}Select the CSV file{% endtrans %}</legend>
    {{ form_row(form.file) }}
    {{ form_row(form.delimiter) }}
</fieldset>
<div class="form-group row">
    <div class="col-md-9 offset-md-3">
        {{ form_widget(form.upload) }}
        {{ form_widget(form.cancel) }}
    </div>
</div>
{{ form_end(form) }}

<div class="alert alert-info">
    <h4>{% trans %}About the CSV file{% endtrans %}</h4>
    <dl>
        <dt>{% trans %}Line endings in the file must NOT be the old Macintosh-type{% endtrans %} <code>(\r)</code></dt>
    </dl>
    <dl>
        <dt>{% trans %}The first row of the CSV file must contain the field names. It must be like this:{% endtrans %}</dt>
        <dd>uname,pass,email,activated,sendmail,groups</dd>
    </dl>
    <dl>
        <dt>{% trans %}where:{% endtrans %}</dt>
        <dd>* uname{% trans %} (mandatory) - The user name. This value must be unique.{% endtrans %}</dd>
        <dd>* pass{% trans with {"%sub%": getModVar('ZikulaZAuthModule', constant('Zikula\\ZAuthModule\\ZAuthConstant::MODVAR_PASSWORD_MINIMUM_LENGTH'))} %} (mandatory) - The user password. It must have %sub% characters or more. Preferentially containing letters and numbers.{% endtrans %}</dd>
        <dd>* email{% trans %} (mandatory) - The user email. If the validation method is based on the user email this value must be unique.{% endtrans %}</dd>
        <dd>* activated{% trans %} - Type 0 if user is not active, 1 if the user must be active. The default value is 1.{% endtrans %}</dd>
        <dd>* sendmail{% trans %} - Type 1 if the system must send the password to the user via email and 0 otherwise. The default value is 1. The module Mailer must be active and correctly configured. The email is sent only if user activated value is upper than 0.{% endtrans %}</dd>
        <dd>* groups{% trans with {"%sub%": defaultGroupName} %} - The identities of the groups where the user must belong separated by the character |. If you do not specify any group, the default group is %sub%.  Undefined groups will be ignored.{% endtrans %}</dd>
    </dl>
    <dl>
        <dt>{% trans %}An example of a valid CSV file{% endtrans %}</dt>
        <dd>uname,pass,email,activated,sendmail,groups</dd>
        <dd>{% trans %}albert,12secure09,albert@example.org,1,1,2{% endtrans %}</dd>
        <dd>{% trans %}george,lesssecure,george@example.org,1,0,1|5{% endtrans %}</dd>
        <dd>{% trans %}robert,hispassword,robert@example.org,,,{% endtrans %}</dd>
    </dl>
    <dl>
        <dt>{% trans %}Another example of a valid CSV file{% endtrans %}</dt>
        <dd>uname,pass,email</dd>
        <dd>{% trans %}albert,12secure09,albert@example.org{% endtrans %}</dd>
        <dd>{% trans %}george,lesssecure,george@example.org{% endtrans %}</dd>
        <dd>{% trans %}robert,hispassword,robert@example.org{% endtrans %}</dd>
    </dl>
</div>
