{% extends "layout.html" %} {% from "macros/form_inputs.html" import input_csrf_token with context %} {% from "macros/general.html" import display_subnav, display_input_cn, display_preferred_language, display_reset_password, display_random_password, display_quota with context %} {% from "macros/msg_handlers.html" import user_msg_handler with context %} {% block title %}{{ _('Add mail user') }}{% endblock title %} {% block navlinks_create %}class="active"{% endblock %} {% block breadcrumb %} {% set crumbs = [ (ctx.homepath + '/domains', _('All domains')), (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain), (ctx.homepath + '/users/' + cur_domain, _('Users')), (ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), (ctx.homepath + '/admins/' + cur_domain, _('Admins')), ] %} {% if backend != "pgsql" %} {% set crumbs = crumbs + [(ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %} {% endif %} {{ display_subnav(crumbs) }} {% endblock %} {% block main %} {# Show system message #} {% if msg %} {% if msg.startswith('PW_') %} {% set _pw_errors = msg.split(',') %} {% for _err in _pw_errors %} {{ user_msg_handler(_err) }} {% endfor %} {% else %} {{ user_msg_handler(msg) }} {% endif %} {% endif %} {# -- Allow to create new account --#} {% set createNewAccount = true %} {% set numberOfSpareAccounts = profile.mailboxes - num_existing_users %} {% set spareQuotaBytes = (profile.maxquota - usedQuotaSize) * 1024 * 1024 %} {% if profile.mailboxes == -1 %} {% set createNewAccount = false %} {% set whyDisabledCreation = _('Not allowed to create mail alias under this domain.') %} {% elif profile.mailboxes > 0 and numberOfSpareAccounts <= 0 %} {% set createNewAccount = false %} {% set whyDisabledCreation = _('Already exceed max number of account limit (%d).') |format(profile.mailboxes |int) %} {% endif %} {% if profile.maxquota > 0 and spareQuotaBytes <= 0 %} {% set createNewAccount = false %} {% set whyDisabledCreation = _('No free domain quota left.') %} {% endif %} {# Display input field for adding new user. #} {% if not createNewAccount %}

{{ _('Error:') }} {{ _('You can NOT create more users under domain %s.') |format('' + cur_domain + '') }} {{ whyDisabledCreation }} {# Show link to change limit #} {% if session.get('is_global_admin') %} {% if profile.mailboxes > 0 and numberOfSpareAccounts <= 0 %} {{ _('Increase it now?') }} {% endif %} {% endif %}

{% else %} {% if profile.mailboxes > 0 and numberOfSpareAccounts > 0 %}

{{ _('You can create %d more mail user(s) under domain %s.') |format(numberOfSpareAccounts, '' + cur_domain + '') }}

{% endif %} {% endif %}
{{ input_csrf_token() }}

{{ _('Add mail user under domain') }} *

{{ _('Mail Address') }} *

@{{ cur_domain }}
 
{{ display_reset_password( min_passwd_length=min_passwd_length, max_passwd_length=max_passwd_length, store_password_in_plain_text=store_password_in_plain_text, enable_input=createNewAccount, ) }}
 
{{ display_input_cn( value=cn, account_type='user', enable_input=createNewAccount, ) }} {{ display_preferred_language( value=domain_settings.get('default_language', 'en_US'), languagemaps=languagemaps, enable_input=createNewAccount, ) }} {{ display_quota(value=domain_settings.get('default_user_quota', 0), spare_quota_bytes=spareQuotaBytes, show_spare_quota=true, show_value_in_input=true, show_used_quota=false, enable_input=createNewAccount) }}
{# .col2-3 #}
{{ display_random_password(password_length=min_passwd_length, password_policies=password_policies) }}
{# .columns #}

 

{# -- End box-wrap -- #}
{# -- End content-box -- #}
{# -- End box-body -- #} {% endblock main %}