From ae35dc59864233961e7baa589552431bacae0216 Mon Sep 17 00:00:00 2001 From: Harold Finch <104512346+finch-harold@users.noreply.github.com> Date: Mon, 10 Apr 2023 07:23:44 +0200 Subject: [PATCH] Add files via upload --- templates/default/amavisd/inout.html | 280 ++ templates/default/amavisd/quarantined.html | 131 + .../default/amavisd/quarantined_raw.html | 30 + .../default/amavisd/quarantined_user.html | 98 + templates/default/amavisd/spampolicy.html | 65 + templates/default/amavisd/wblist/create.html | 60 + templates/default/amavisd/wblist/global.html | 68 + templates/default/amavisd/wblist/user.html | 41 + templates/default/dashboard.html | 230 ++ templates/default/error_csrf.html | 8 + templates/default/error_without_login.html | 19 + templates/default/fail2ban/banned.html | 114 + .../default/fail2ban/matched_log_lines.html | 21 + .../activities/smtp_outbound_sessions.html | 96 + .../iredapd/activities/smtp_sessions.html | 108 + .../default/iredapd/greylisting_global.html | 109 + .../iredapd/greylisting_tracking_records.html | 26 + .../default/iredapd/throttle_global.html | 78 + templates/default/iredapd/wblist/rdns.html | 78 + templates/default/layout.html | 231 ++ templates/default/layout_user.html | 135 + templates/default/login.html | 85 + templates/default/macros/amavisd.html | 453 +++ templates/default/macros/form_inputs.html | 205 ++ templates/default/macros/general.html | 2450 +++++++++++++++++ templates/default/macros/iredapd.html | 566 ++++ templates/default/macros/mlmmj.html | 410 +++ templates/default/macros/msg_handlers.html | 475 ++++ templates/default/macros/sql.html | 210 ++ templates/default/mlmmj/errors.html | 16 + templates/default/mlmmj/layout.html | 21 + templates/default/mlmmj/subunsub.html | 80 + templates/default/panel/domain_ownership.html | 113 + templates/default/panel/license.html | 93 + templates/default/panel/log.html | 143 + templates/default/panel/settings.html | 159 ++ templates/default/sql/admin/create.html | 74 + templates/default/sql/admin/list.html | 118 + templates/default/sql/admin/profile.html | 165 ++ templates/default/sql/alias/create.html | 135 + templates/default/sql/alias/list.html | 152 + templates/default/sql/alias/profile.html | 142 + templates/default/sql/domain/create.html | 62 + templates/default/sql/domain/list.html | 286 ++ templates/default/sql/domain/profile.html | 773 ++++++ templates/default/sql/ml/create.html | 131 + templates/default/sql/ml/list.html | 155 ++ templates/default/sql/ml/profile.html | 185 ++ templates/default/sql/search.html | 469 ++++ .../default/sql/self-service/ml/list.html | 74 + .../default/sql/self-service/ml/profile.html | 127 + .../sql/self-service/user/preferences.html | 138 + .../default/sql/user/all_last_logins.html | 167 ++ templates/default/sql/user/create.html | 186 ++ templates/default/sql/user/list.html | 332 +++ templates/default/sql/user/profile.html | 606 ++++ 56 files changed, 11982 insertions(+) create mode 100644 templates/default/amavisd/inout.html create mode 100644 templates/default/amavisd/quarantined.html create mode 100644 templates/default/amavisd/quarantined_raw.html create mode 100644 templates/default/amavisd/quarantined_user.html create mode 100644 templates/default/amavisd/spampolicy.html create mode 100644 templates/default/amavisd/wblist/create.html create mode 100644 templates/default/amavisd/wblist/global.html create mode 100644 templates/default/amavisd/wblist/user.html create mode 100644 templates/default/dashboard.html create mode 100644 templates/default/error_csrf.html create mode 100644 templates/default/error_without_login.html create mode 100644 templates/default/fail2ban/banned.html create mode 100644 templates/default/fail2ban/matched_log_lines.html create mode 100644 templates/default/iredapd/activities/smtp_outbound_sessions.html create mode 100644 templates/default/iredapd/activities/smtp_sessions.html create mode 100644 templates/default/iredapd/greylisting_global.html create mode 100644 templates/default/iredapd/greylisting_tracking_records.html create mode 100644 templates/default/iredapd/throttle_global.html create mode 100644 templates/default/iredapd/wblist/rdns.html create mode 100644 templates/default/layout.html create mode 100644 templates/default/layout_user.html create mode 100644 templates/default/login.html create mode 100644 templates/default/macros/amavisd.html create mode 100644 templates/default/macros/form_inputs.html create mode 100644 templates/default/macros/general.html create mode 100644 templates/default/macros/iredapd.html create mode 100644 templates/default/macros/mlmmj.html create mode 100644 templates/default/macros/msg_handlers.html create mode 100644 templates/default/macros/sql.html create mode 100644 templates/default/mlmmj/errors.html create mode 100644 templates/default/mlmmj/layout.html create mode 100644 templates/default/mlmmj/subunsub.html create mode 100644 templates/default/panel/domain_ownership.html create mode 100644 templates/default/panel/license.html create mode 100644 templates/default/panel/log.html create mode 100644 templates/default/panel/settings.html create mode 100644 templates/default/sql/admin/create.html create mode 100644 templates/default/sql/admin/list.html create mode 100644 templates/default/sql/admin/profile.html create mode 100644 templates/default/sql/alias/create.html create mode 100644 templates/default/sql/alias/list.html create mode 100644 templates/default/sql/alias/profile.html create mode 100644 templates/default/sql/domain/create.html create mode 100644 templates/default/sql/domain/list.html create mode 100644 templates/default/sql/domain/profile.html create mode 100644 templates/default/sql/ml/create.html create mode 100644 templates/default/sql/ml/list.html create mode 100644 templates/default/sql/ml/profile.html create mode 100644 templates/default/sql/search.html create mode 100644 templates/default/sql/self-service/ml/list.html create mode 100644 templates/default/sql/self-service/ml/profile.html create mode 100644 templates/default/sql/self-service/user/preferences.html create mode 100644 templates/default/sql/user/all_last_logins.html create mode 100644 templates/default/sql/user/create.html create mode 100644 templates/default/sql/user/list.html create mode 100644 templates/default/sql/user/profile.html diff --git a/templates/default/amavisd/inout.html b/templates/default/amavisd/inout.html new file mode 100644 index 0000000..35fb676 --- /dev/null +++ b/templates/default/amavisd/inout.html @@ -0,0 +1,280 @@ +{% if session.get('account_is_mail_user') %} + {% extends "layout_user.html" %} +{% else %} + {% extends "layout.html" %} +{% endif %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + set_account_activity_img, + show_pages + with context + %} + +{% from "macros/amavisd.html" import + display_search_modal, + display_idtabs_of_maillog, + display_icon_of_account_profile + with context + %} + +{% from "macros/msg_handlers.html" import amavisd_msg_handler with context %} + +{% block title %} +{% if log_type == 'sent' %} + {{ _('Sent Mails') }} +{% elif log_type == 'received' %} + {{ _('Received Mails') }} +{% endif %} +{% endblock %} + +{% if session.get('account_is_mail_user') %} + {% block navlinks_rcvd_mails %}class="active"{% endblock %} +{% else %} + {% block navlinks_activities %}class="active"{% endblock %} +{% endif %} + +{% block main %} +{# Show system message #} +{{ amavisd_msg_handler(msg) }} + +{# Hide sender, recipient, score #} +{% set show_sender = True %} +{% set show_recipient = True %} +{% set show_score = False %} + +{% if log_type == 'sent' and account_type == 'user' %} + {% set show_sender = False %} +{% endif %} + +{% if log_type == 'received' and account_type == 'user' %} + {% set show_recipient = False %} +{% endif %} + +{% if session.get('account_is_mail_user') %} + {% set show_recipient = False %} +{% endif %} + +{% if log_type == 'received' %} + {% set show_score = True %} +{% endif %} + +{% if log_type == 'sent' %} + {% if account_type == 'domain' %} + {% set tab_title = _('Mails Sent by Domain: %s') |format(account) %} + {% set pages_baseurl = ctx.homepath + '/activities/sent/domain/' + account %} + {% elif account_type == 'user' %} + {% set tab_title = _('Mails Sent by User: %s') |format(account) %} + {% set pages_baseurl = ctx.homepath + '/activities/sent/user/' + account %} + {% else %} + {% set tab_title = _('Sent Mails') %} + {% set pages_baseurl = ctx.homepath + '/activities/sent' %} + {% endif %} + +{% elif log_type == 'received' %} + {% if account_type == 'domain' %} + {% set tab_title = _('Received Mails of Domain: %s') |format(account) %} + {% set pages_baseurl = ctx.homepath + '/activities/received/domain/' + account %} + {% elif account_type == 'user' %} + {% set tab_title = _('Received Mails of User: %s') |format(account) %} + {% set pages_baseurl = ctx.homepath + '/activities/received/user/' + account %} + {% else %} + {% set tab_title = _('Received Mails') %} + {% set pages_baseurl = ctx.homepath + '/activities/received' %} + {% endif %} +{% endif %} + +
+
+ {% if session.get('account_is_mail_user') %} + {% set pages_baseurl = ctx.homepath + '/activities/received/user/' + account %} + {% else %} + +
+
    + {{ display_idtabs_of_maillog(log_type=log_type, account_type=account_type, account=account) }} +
+ +

+ {{ tab_title }} + + {% if total is defined and records |length > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + records |length}}/{{ total }}) + {% endif %} + + {% if removeLogsInDays > 0 %} + + {% endif %} + + {% if not session.get('account_is_mail_user') %} + + {{ display_icon_of_account_profile(account_type=account_type, account=account) }} + {% endif %} + +

+ + {% if removeLogsInDays > 0 %} + + {% endif %} + + {{ display_search_modal() }} +
{# box-header #} + {% endif %} {# account_is_mail_user #} + + {% if account_type %} +
+ {% else %} + + {% endif %} + + {{ input_csrf_token() }} + + + + + + {% if show_sender %} + + {% endif %} + + {% if show_recipient %} + + {% endif %} + + + + {% if log_type == 'received' -%} + + {% endif %} + + + + + + + {% if records %} + {% for r in records %} + + {% set sender_email = r.sender_email |e %} + {% set recipient = r.recipient |e %} + + + {% if log_type == 'sent' %} + {# Process recipients #} + + {% else %} + {# Process senders #} + + {% endif %} + + + {% if show_sender %} + + {% endif %} + + {% if show_recipient %} + + {% endif %} + + + + {% if show_score %} + + {% endif %} + + + + {% endfor %} + {% else %} + + + {% set colspan = 6 %} + + {% if log_type == 'sent' %} + {# no 'Score' column #} + {% set colspan = colspan - 1 %} + {% endif %} + + {% if session.get('account_is_mail_user') %} + {# no 'Recipient' column #} + {% set colspan = colspan - 1 %} + {% endif %} + + {% if log_type == 'sent' %} + + {% elif log_type == 'received' %} + + {% endif %} + + {% endif %} + +
{{ _('Subject') }}{{ _('Sender') }}{{ _('Recipient') }}{{ _('Size') }}{{ _('Score') }}{{ _('Date') }}
{{ r.subject |e }}{{ sender_email }} + {%- if account_type is sameas none -%} + + {{ set_account_activity_img('sent', 'user', sender_email, float='right') }} + {% endif %} + {{ recipient }} + {%- if account_type is sameas none -%} + + {{ set_account_activity_img('received', 'user', recipient, float='right') }} + {% endif %} + {{ r.size |file_size_format |e }}{{ r.spam_level |e }}{{ r.time_num |epoch_seconds_to_gmt | utc_to_timezone(timezone=session['timezone']) }}
{{ _('No outgoing mails.') }}{{ _('No incoming mails.') }}
+ + {# .tab-footer #} +
+
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/amavisd/quarantined.html b/templates/default/amavisd/quarantined.html new file mode 100644 index 0000000..ada31fd --- /dev/null +++ b/templates/default/amavisd/quarantined.html @@ -0,0 +1,131 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import input_csrf_token with context %} +{% from "macros/general.html" import show_pages with context %} + +{% from "macros/amavisd.html" import + display_search_modal, + display_idtabs_of_maillog, + display_icon_of_account_profile, + display_amavisd_quarantined_mails + with context + %} + +{% from "macros/msg_handlers.html" import amavisd_msg_handler with context %} + +{% block title %}{{ _('Quarantined Mails') }}{% endblock %} +{% block navlinks_activities %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ amavisd_msg_handler(msg) }} + +
+
+
+
    + {% if account_type is sameas none %} +
  • {{ _('Admin Log') }}
  • + {% endif %} + + {{ display_idtabs_of_maillog(log_type='quarantined', account_type=account_type, account=account) }} +
+ +

+ {% if account_type == 'domain' %} + {{ _('Quarantined Mails of Domain: %s') |format(account) }} + {% set pages_baseurl = ctx.homepath + '/activities/quarantined/domain/' + account %} + {% elif account_type == 'user' %} + {{ _('Quarantined Mails of User: %s') |format(account) }} + {% set pages_baseurl = ctx.homepath + '/activities/quarantined/user/' + account %} + {% else %} + {{ _('Quarantined Mails') }} + {% set pages_baseurl = ctx.homepath + '/activities/quarantined' %} + {% endif %} + + {% if quarantined_type %} + {% set pages_baseurl = pages_baseurl + '/' + quarantined_type %} + {% endif %} + + {% if total is defined and records|length > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + records |length}}/{{ total }}) + {% endif %} + + + + + {{ display_icon_of_account_profile(account_type=account_type, account=account) }} +

+ + + + {{ display_search_modal() }} +
{# .box-header #} + +
+ + {{ input_csrf_token() }} + + {{ display_amavisd_quarantined_mails(records, + account=account, + account_type=account_type, + sort_by_score=sort_by_score) }} + + +
+ +
{# -- End .box-body -- #} +
{# -- End .content-box -- #} + +{% endblock main %} diff --git a/templates/default/amavisd/quarantined_raw.html b/templates/default/amavisd/quarantined_raw.html new file mode 100644 index 0000000..ac8ff1d --- /dev/null +++ b/templates/default/amavisd/quarantined_raw.html @@ -0,0 +1,30 @@ +{# Please do apply template filter 'e' to show mail content #} + +   + + + + + + {% if attachments |length > 0 %} + + + {% for fn in attachments %} + + + + + {% endfor %} + {% endif %} + + + {% for hdr in headers %} + + + + + {% endfor %} +
{{ _('Mail Body') }}
{% for body_part in bodies %}

{{ body_part |e }}

{% endfor %}
{{ _('Attachments') }}
{{ loop.index }}{{ fn |e }}
{{ _('Mail Headers') }}
{{ hdr[0] |e }}{{ hdr[1] |e }}
+ +   + diff --git a/templates/default/amavisd/quarantined_user.html b/templates/default/amavisd/quarantined_user.html new file mode 100644 index 0000000..26d1965 --- /dev/null +++ b/templates/default/amavisd/quarantined_user.html @@ -0,0 +1,98 @@ +{% extends "layout_user.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + show_pages + with context + %} + +{% from "macros/amavisd.html" import + display_search_modal, + display_amavisd_quarantined_mails + with context %} + +{% from "macros/msg_handlers.html" import amavisd_msg_handler with context %} + +{% block title %}{{ _('Quarantined Mails') }}{% endblock %} +{% block navlinks_quarantined %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ amavisd_msg_handler(msg) }} + +
+
+ {% if account_type is sameas none %} +
+ {% else %} + + {% endif %} + + {{ input_csrf_token() }} + + {{ display_amavisd_quarantined_mails(records, + account=account, + account_type=account_type, + show_link_for_email=false, + show_recipient=false, + sort_by_score=sort_by_score) }} + + {% set disabled_user_preferences = session.get('disabled_user_preferences', []) %} + + +
+ +
{# -- End .box-body -- #} +
{# -- End .content-box -- #} + +{% endblock main %} diff --git a/templates/default/amavisd/spampolicy.html b/templates/default/amavisd/spampolicy.html new file mode 100644 index 0000000..7b8610c --- /dev/null +++ b/templates/default/amavisd/spampolicy.html @@ -0,0 +1,65 @@ +{% if session.get('account_is_mail_user') %} + {% extends "layout_user.html" %} + {% block navlinks_spampolicy %}class="active"{% endblock %} +{% else %} + {% extends "layout.html" %} + {% block navlinks_system %}class="active"{% endblock %} +{% endif %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav + with context %} + +{% from "macros/amavisd.html" import display_spam_policy with context %} +{% from "macros/msg_handlers.html" import user_msg_handler with context %} + +{% block title %}{{ _('Spam Policy') }}{% endblock %} + +{% if session.get('is_global_admin') %} +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') and session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [('active', ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + (ctx.homepath + '/system/wblist', _('Whitelists & Blacklists'))] %} + {% endif %} + + {% if session.get('is_global_admin') %} + {% if session.get('iredapd_enabled') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/greylisting', _('Greylisting')), + (ctx.homepath + '/system/throttle', _('Throttling')), + ] %} + {% endif %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} +{% endif %} + +{% block main %} + +{#-- Show system message --#} +{{ user_msg_handler(msg) }} + +
+
+
+
+ {{ input_csrf_token() }} + + {{ display_spam_policy(account_type=account_type, + spampolicy=spampolicy, + custom_ban_rules=custom_ban_rules, + global_spam_score=global_spam_score) }} + + {{ input_submit() }} +
+
{# box-wrap #} +
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/amavisd/wblist/create.html b/templates/default/amavisd/wblist/create.html new file mode 100644 index 0000000..e4d524f --- /dev/null +++ b/templates/default/amavisd/wblist/create.html @@ -0,0 +1,60 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + display_per_account_wblist_all + with context + %} + +{% from "macros/msg_handlers.html" import amavisd_msg_handler with context %} + +{% block title %}{{ _('Add whitelist and blacklist') }}{% endblock %} +{% block navlinks_create %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') %} + {% if session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + (ctx.homepath + '/system/wblist', _('Whitelists & Blacklists'))] %} + {% endif %} + + {% if session.get('iredapd_enabled') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/greylisting', _('Greylisting')), + (ctx.homepath + '/system/throttle', _('Throttling')), + ] %} + {% endif %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{# Show system message #} +{{ amavisd_msg_handler(msg) }} + +
+
+
+

{{ _('Add whitelist and blacklist') }}

+
+ +
+
+ {{ input_csrf_token() }} + + {{ display_per_account_wblist_all([], [], [], []) }} + + {{ input_submit(label=_('Add')) }} +
+
{# .box-wrap #} +
{# .box-body #} +
{# .content-box #} +{% endblock main %} diff --git a/templates/default/amavisd/wblist/global.html b/templates/default/amavisd/wblist/global.html new file mode 100644 index 0000000..0e2a340 --- /dev/null +++ b/templates/default/amavisd/wblist/global.html @@ -0,0 +1,68 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + display_per_account_wblist_all, + show_pages + with context + %} + +{% from "macros/msg_handlers.html" import amavisd_msg_handler with context %} + +{% block title %}{{ _('Whitelists & Blacklists') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') %} + {% if session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + ('active', ctx.homepath + '/system/wblist', _('Whitelists & Blacklists'))] %} + {% endif %} + + {% if session.get('iredapd_enabled') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/greylisting', _('Greylisting')), + (ctx.homepath + '/system/throttle', _('Throttling')), + ] %} + {% endif %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{#-- Show system message --#} +{{ amavisd_msg_handler(msg) }} + +
+
+
+ +

{{ _('Whitelists and Blacklists based on sender addresses') }}

+
+ +
+
+ {{ input_csrf_token() }} + + {{ display_per_account_wblist_all(inbound_whitelists=whitelists, + inbound_blacklists=blacklists, + outbound_whitelists=outbound_whitelists, + outbound_blacklists=outbound_blacklists) }} + + {{ input_submit() }} +
+
{# box-wrap #} +
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/amavisd/wblist/user.html b/templates/default/amavisd/wblist/user.html new file mode 100644 index 0000000..6210fab --- /dev/null +++ b/templates/default/amavisd/wblist/user.html @@ -0,0 +1,41 @@ +{% extends "layout_user.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + set_account_activity_img, + display_subnav, + display_per_account_wblist_all + with context + %} + +{% from "macros/msg_handlers.html" import user_msg_handler with context %} + +{% block title %}{{ _('White/Blacklist') }}{% endblock %} +{% block navlinks_wblist %}class="active"{% endblock %} + +{% block main %} + +{#-- Show system message --#} +{{ user_msg_handler(msg) }} + +
+
+
+
+ {{ input_csrf_token() }} + + {{ display_per_account_wblist_all(inbound_whitelists=whitelists, + inbound_blacklists=blacklists, + show_outbound_wblist=False) }} + + {{ input_submit() }} +
+
{# box-wrap #} +
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/dashboard.html b/templates/default/dashboard.html new file mode 100644 index 0000000..b774219 --- /dev/null +++ b/templates/default/dashboard.html @@ -0,0 +1,230 @@ +{# version, hostname, uptime, loadavg, #} + +{% extends "layout.html" %} +{% from "macros/msg_handlers.html" import success_info, error_info with context %} + +{% block title %} {{ _('Dashboard') }} {% endblock %} +{% block navlinks_dashboard %}class="active"{% endblock %} + +{% block main %} + +{# Checked and get response data #} +{% if session.get('new_version_available') %} + {{ success_info( _("New version of iRedAdmin-Pro, %s, is now available for upgrading. Details") |format(session.get('new_version') |e, ctx.homepath), removable=false, trusted=true ) }} +{% elif session.get('new_version_available') is sameas false %} + {# Error while checking new version #} + {{ error_info( _('Error while checking new version of iRedAdmin-Pro:') + ' ' + session.get('new_version_check_error') |e ) }} +{% endif %} + +
+
+ {% if session.get('amavisd_enable_logging') or session.get('fail2ban_enabled') or session.get('iredapd_enabled') %} +

{{ _('Statistics of latest 24 hours') |title }}

+ + + {% if session.get('amavisd_enable_logging') %} + + + + {% if session.get('disable_viewing_mail_log') %} + + {% else %} + + {% endif %} + + + + + + {% if session.get('disable_viewing_mail_log') %} + + {% else %} + + {% endif %} + + + {% if session.get('amavisd_enable_quarantine') %} + + + + {% if session.get('disable_viewing_mail_log') %} + + {% else %} + + {% endif %} + + + + + + {% if session.get('disable_managing_quarantined_mails') %} + + {% else %} + + {% endif %} + + {% endif %} + {% endif %} + + {% if session.get('iredapd_enabled') %} + + + + + + + + + + + + {% endif %} + + {% if session.get('is_global_admin') and session.get('fail2ban_enabled') %} + + + + + + {% endif %} +
{{ _('Received') }}{{ num_incoming_mails }}{{ num_incoming_mails }}
{{ _('Sent') }}{{ num_outgoing_mails }}{{ num_outgoing_mails }}
{{ _('Virus') }}{{ num_virus }}{{ num_virus }}
{{ _('Quarantined') }}{{ num_quarantined }}{{ num_quarantined }}
{{ _('Rejected Messages') }}{{ num_rejected }}
{{ _('Outbound SMTP Sessions') }}{{ num_smtp_outbound_sessions }}
{{ _('Banned IP Addresses') }}{{ num_banned }}
+ {% endif %} + +

{{ _('System Information') }}

+
+ + + {# Show number of total domains, users, aliases #} + + + + + + {% if backend in ['mysql', 'pgsql'] %} + + + + + + + + + + + + + + + {% endif %} + + {% if session.get('is_global_admin') %} + {% if session.get('show_used_quota') %} + + + + + {% endif %} + + + + + + + + + + + {# ---- System Information ---- #} + + + + + + {% if uptime is not sameas none and uptime|length == 3 %} + + + + + {% endif %} + + + + + + + {# ---- Network interfaces and IP info ---- #} + {% for netif in netif_data %} + + + + + {% endfor %} + {% endif %}{# global admin #} + +
{{ _('Number of domains') }}{{ num_existing_domains |e }}{% if backend in ['mysql', 'pgsql'] %}{% if num_max_domains >= 0 %} ({{ _('Max:') }} {{ num_max_domains }}){% endif %}{% endif %}
{{ _('Number of users') }}{{ num_existing_users |e }}{% if num_max_users >= 0 %} ({{ _('Max:') }} {{ num_max_users }}){% endif %}
{{ _('Number of mailing lists') }}{{ num_existing_lists |e }}{% if num_max_lists >= 0 %} ({{ _('Max:') }} {{ num_max_lists }}){% endif %}
{{ _('Number of aliases') }}{{ num_existing_aliases |e }}{% if num_max_aliases >= 0 %} ({{ _('Max:') }} {{ num_max_aliases }}){% endif %}
{{ _('Stored emails') }}{% if total_messages %}{{ total_messages |e }} {{ _('Emails') }}.{% endif %} {% if total_bytes %}{{ total_bytes |file_size_format }}.{% endif %}
iRedMail{{ iredmail_version }}
iRedAdmin-Pro{{ version |e }} + {% if backend == 'mysql' %} + (MySQL) + {% elif backend == 'pgsql' %} + (PostgreSQL) + {% elif backend == 'ldap' %} + (LDAP) + {% endif %} +
{{ _('Hostname') }}{{ hostname |e }}
{{ _('Uptime') }}{{ _('%s days, %s hours, %s minutes.') |format(uptime[0] |e, uptime[1] |e, uptime[2] |e ) }}
{{ _('Server Load') }}{{ loadavg[0] }}, {{ loadavg[1] }}, {{ loadavg[2] }}
{{ _('Network') }} ({{ netif[0] |e }}){{ netif[1] }}
+
{# .box-wrap #} +
{# col1-3 #} + +{% if session.get('amavisd_enable_logging') %} +
+

{{ _('Top Senders') |title }}

+ + + {% for s in top_senders %} + + + {% if s.mail %} + {% set _mail = s.mail |e %} + + {% if session.get('disable_viewing_mail_log') is sameas true %} + + {% elif s.policy == 'MLMMJ' %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} + + {% endfor %} + +
{{ s.total |e }}{{ _mail }}{{ _mail }} ({{ _('Mailing List') }}){{ _mail }}<>
+
+ +
+

{{ _('Top Recipients') |title }}

+ + + {% for s in top_recipients %} + + + + {% if s.mail %} + {% set _mail = s.mail |e %} + + {% if session.get('disable_viewing_mail_log') is sameas true %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} + + {% endfor %} + +
{{ s.total |e }}{{ _mail }}{{ _mail }}<>
+
+
+{% endif %} + +{% endblock main %} diff --git a/templates/default/error_csrf.html b/templates/default/error_csrf.html new file mode 100644 index 0000000..60fdedd --- /dev/null +++ b/templates/default/error_csrf.html @@ -0,0 +1,8 @@ +{% extends "layout.html" %} +{% from "macros/msg_handlers.html" import error_info %} + +{% block main %} +
+ {{ error_info(_('Security token did not match. Please refresh current page and re-perform form action.')) }} +
+{% endblock %} diff --git a/templates/default/error_without_login.html b/templates/default/error_without_login.html new file mode 100644 index 0000000..6d46c4b --- /dev/null +++ b/templates/default/error_without_login.html @@ -0,0 +1,19 @@ + + + + + + + {{ _('Error') }} + + + + + + +{% from "macros/msg_handlers.html" import login_msg_handler with context %} + + + {{ login_msg_handler(error) }} + + diff --git a/templates/default/fail2ban/banned.html b/templates/default/fail2ban/banned.html new file mode 100644 index 0000000..34e70bd --- /dev/null +++ b/templates/default/fail2ban/banned.html @@ -0,0 +1,114 @@ +{% extends "layout.html" %} + +{% block title %}{{ _('Banned IP Addresses') }}{% endblock %} +{% block navlinks_activities %}class="active"{% endblock %} + + +{% block main %} + +
+
+
+

{{ _('Banned IP Addresses') }} + ({{ rows | length }}) + +

+
+ +
+ + + + + + + + + + + + + + + {% if rows |length == 0 %} + + + + {% endif %} + + {% for row in rows %} + {% set row_id = loop.index %} + + {% set record_id = row.id | int %} + {% set ip = row.ip |e %} + {% set remove = row.remove | int %} + + {# `failures=0` means banned manually, no matched log lines stored in sql db. #} + {% set failures = row.failures | int %} + + + + + + + + + + {% endfor %} + +
{{ _('IP Address') }}{{ _('Client Hostname') }}{{ _('Country') }}{{ _('Ports') }}{{ _('Jail') }}{{ _('Time') }}
{{ _('No banned IP address.') }}
+ {{ ip }} + {% if remove == 0 %} + {{ _('Unban') }} + {% else %} + {{ _('Pending') }} + {% endif %} + + {% if failures > 0 %} + {{ _('Log') }} + {% endif %} + {% if row.rdns %}{{ row.rdns |e }}{% endif %}{{ row.country |e }}{{ row.ports.replace(',', ', ') |e }}{{ row.jail |e }}{{ row.timestamp | utc_to_timezone(timezone=session['timezone'])}}
+
+
+{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/fail2ban/matched_log_lines.html b/templates/default/fail2ban/matched_log_lines.html new file mode 100644 index 0000000..23a4c98 --- /dev/null +++ b/templates/default/fail2ban/matched_log_lines.html @@ -0,0 +1,21 @@ + diff --git a/templates/default/iredapd/activities/smtp_outbound_sessions.html b/templates/default/iredapd/activities/smtp_outbound_sessions.html new file mode 100644 index 0000000..32b55bb --- /dev/null +++ b/templates/default/iredapd/activities/smtp_outbound_sessions.html @@ -0,0 +1,96 @@ +{% extends "layout.html" %} + +{% from "macros/general.html" import + set_account_activity_img, + display_subnav, + show_pages + with context %} + +{% from "macros/iredapd.html" import + display_smtp_outbound_sessions, + display_idtabs_of_smtp_sessions + with context %} + +{% block title %}{{ _('Outbound SMTP Sessions') }}{% endblock %} +{% block navlinks_activities %}class="active"{% endblock %} + +{% block main %} + +
+
+
+
    + {{ display_idtabs_of_smtp_sessions(activity='outbound_smtp') }} +
+ + {% set kw_map = {'domain': _('Domain'), + 'sasl_username': _('Authenticated User'), + 'sender': _('Envelope Sender'), + 'recipient': _('Recipient'), + 'ip': _('IP Address'), + 'encryption_protocol': _('Encryption Protocol'), + } %} + +

+ {{ _('Outbound SMTP Sessions') }} + + {% if account_type in ['domain', 'sasl_username', 'sender', 'recipient', 'client_address', 'encryption_protocol'] %} + {{ kw_map[account_type] }} {{ account }} + {% endif %} + + {% if total %} + ({{ (current_page-1) * page_size_limit + 1 }}-{{ (current_page-1) * page_size_limit + (rows |length) }}/{{ total }}) + {% endif %} +

+
+ +
+ {% if num_insecure_outbound is defined and num_insecure_outbound > 0 %} + + +

+ + {{ _('%d users sent emails without secure connection in last %d hours.') |format(num_insecure_outbound, query_insecure_outbound_hours) }} +

+ {% endif %} + + {{ display_smtp_outbound_sessions(rows=rows) }} + + {% set baseurl = ctx.homepath + '/activities/smtp/sessions/outbound' %} + {% if account_type and account %} + {% set baseurl = baseurl + '/' + account_type + '/' + account %} + {% endif %} + + {{ show_pages(baseurl=baseurl, + total=total, + cur_page=current_page) }} +
+
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/iredapd/activities/smtp_sessions.html b/templates/default/iredapd/activities/smtp_sessions.html new file mode 100644 index 0000000..368a920 --- /dev/null +++ b/templates/default/iredapd/activities/smtp_sessions.html @@ -0,0 +1,108 @@ +{% extends "layout.html" %} + +{% from "macros/general.html" import + display_subnav, + show_pages + with context %} + +{% from "macros/iredapd.html" import + display_smtp_sessions, + display_idtabs_of_smtp_sessions + with context %} + +{% block title %} + {% if rejected_only %} + {{ _('Rejected SMTP Sessions') }} + {% else %} + {{ _('SMTP Sessions') }} + {% endif %} +{% endblock %} + +{% block navlinks_activities %}class="active"{% endblock %} + +{% block main %} + +
+
+
+
    + {% if rejected_only %} + {{ display_idtabs_of_smtp_sessions(activity='rejected_smtp') }} + {% else %} + {{ display_idtabs_of_smtp_sessions(activity='smtp') }} + {% endif %} +
+ + {% set kw_map = {'domain': _('Domain'), + 'sasl_username': _('User'), + 'sender': _('Envelope Sender'), + 'recipient': _('Recipient'), + 'ip': _('IP Address'), + 'encryption_protocol': _('Encryption Protocol'), + } %} + +

{{ _('SMTP Sessions') }} + + {% if account_type in ['domain', 'sasl_username', 'sender', 'recipient', 'client_address', 'encryption_protocol'] %} + {{ kw_map[account_type] }} {{ account }} + {% endif %} + + {% if total %} + ({{ (current_page-1) * page_size_limit + 1 }}-{{ (current_page-1) * page_size_limit + (rows |length) }}/{{ total }}) + {% endif %} +

+
+ +
+ {{ display_smtp_sessions( + rows=rows, + whitelisted_senderscore_ips=whitelisted_senderscore_ips, + whitelisted_greylisting_ips=whitelisted_greylisting_ips) }} + + {% if rejected_only %} + {% set base_url = ctx.homepath + '/activities/smtp/sessions/rejected' %} + {% else %} + {% set base_url = ctx.homepath + '/activities/smtp/sessions' %} + {% endif %} + + {{ show_pages(baseurl=base_url, + total=total, + cur_page=current_page) }} +
+
{# box-body #} +
{# content-box #} +{% endblock main %} + +{% if session.get('is_global_admin') %} +{% block extra_js %} + +{% endblock extra_js %} +{% endif %} diff --git a/templates/default/iredapd/greylisting_global.html b/templates/default/iredapd/greylisting_global.html new file mode 100644 index 0000000..fc4d82c --- /dev/null +++ b/templates/default/iredapd/greylisting_global.html @@ -0,0 +1,109 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + show_pages + with context + %} + +{% from "macros/iredapd.html" import + display_greylisting_setting, + display_greylisting_whitelist_domains, + display_greylisting_whitelists + with context + %} + +{% from "macros/msg_handlers.html" import greylist_msg_handler with context %} + +{% block title %}{{ _('Greylisting') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') %} + {% if session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + (ctx.homepath + '/system/wblist', _('Whitelists & Blacklists')), + ] %} + {% endif %} + + {% if session.get('iredapd_enabled') %} + {% set crumbs = crumbs + [('active', ctx.homepath + '/system/greylisting', _('Greylisting')), + (ctx.homepath + '/system/throttle', _('Throttling')), + ] %} + {% endif %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{# Show system message #} +{{ greylist_msg_handler(msg) }} + +
+
+
+ +

{{ _('Greylisting') }}

+
+ +
+
+
+ {{ input_csrf_token() }} + + {{ display_greylisting_setting(account='@.', gl_setting=gl_setting) }} + +
 
+ {{ display_greylisting_whitelist_domains(domains=gl_whitelist_domains) }} + +
 
+ {{ display_greylisting_whitelists(account='@.', gl_whitelists=gl_whitelists) }} + + {{ input_submit() }} +
+
+ + {# Tracking data #} +
+

{{ _('Sender domains listed below have not passed greylisting service yet.') }}

+ + + + + + + + + + + {% if tracking_records %} + {% for r in tracking_records %} + {% set sender_domain = r.sender_domain | e %} + + + + + {% endfor %} + {% else %} + + {% endif %} + +
{{ _('Delivery Attempts') }}{{ _('Sender Domain') }}
+ {{ r.total }}{{ sender_domain }}
{{ _('No data available.') }}
+
{# #tracking_data #} +
{# .box-wrap #} +
{# .box-body #} +
{# .content-box #} +{% endblock main %} diff --git a/templates/default/iredapd/greylisting_tracking_records.html b/templates/default/iredapd/greylisting_tracking_records.html new file mode 100644 index 0000000..8ca65e2 --- /dev/null +++ b/templates/default/iredapd/greylisting_tracking_records.html @@ -0,0 +1,26 @@ + diff --git a/templates/default/iredapd/throttle_global.html b/templates/default/iredapd/throttle_global.html new file mode 100644 index 0000000..564dcbb --- /dev/null +++ b/templates/default/iredapd/throttle_global.html @@ -0,0 +1,78 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + show_pages + with context %} + +{% from "macros/iredapd.html" import + display_throttle_setting + with context + %} + +{% from "macros/msg_handlers.html" import throttle_msg_handler with context %} + +{% block title %}{{ _('Throttle') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') and session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + (ctx.homepath + '/system/wblist', _('Whitelists & Blacklists')), + (ctx.homepath + '/system/greylisting', _('Greylisting')), + ('active', ctx.homepath + '/system/throttle', _('Throttle')), + ] %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{# Show system message #} +{{ throttle_msg_handler(msg) }} + +
+
+
+
+
+ {{ input_csrf_token() }} + + {{ display_throttle_setting( + account='@.', + setting=outbound_setting, + inout_type='outbound', + ) }} + + {{ display_throttle_setting( + account='@.', + setting=inbound_setting, + inout_type='inbound', + with_left_border=true, + ) }} + +
+
+
    +
  • {{ _('This is default throttling applied to all individual accounts.') }}
  • +
  • {{ _('You can set per-domain and per-user throttling in account profile page.') }}
  • +
  • {{ _('Per-domain throttling has higher priority than default throttling set in this page, per-user throttling has the highest priority.') }}
  • +
+
+
{#-- .col1-3 --#} +
+ + {{ input_submit() }} +
+
{# .box-wrap #} +
{# .box-body #} +
{# .content-box #} +{% endblock main %} diff --git a/templates/default/iredapd/wblist/rdns.html b/templates/default/iredapd/wblist/rdns.html new file mode 100644 index 0000000..6705b46 --- /dev/null +++ b/templates/default/iredapd/wblist/rdns.html @@ -0,0 +1,78 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav + with context %} + +{% from "macros/iredapd.html" import + display_wblist_rdns, + display_wblist_rdns_formats + with context %} +{% from "macros/msg_handlers.html" import wblist_msg_handler with context %} + +{% block title %}{{ _('Whitelists & Blacklists') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [] %} + {% if session.get('is_global_admin') %} + {% if session.get('amavisd_enable_policy_lookup') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/spampolicy', _('Global Spam Policy')), + ('active', ctx.homepath + '/system/wblist', _('Whitelists & Blacklists'))] %} + {% endif %} + + {% if session.get('iredapd_enabled') %} + {% set crumbs = crumbs + [(ctx.homepath + '/system/greylisting', _('Greylisting')), + (ctx.homepath + '/system/throttle', _('Throttling')), + ] %} + {% endif %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{#-- Show system message --#} +{{ wblist_msg_handler(msg) }} + +
+
+
+ +

{{ _('Whitelists and Blacklists based on reverse DNS name of sender server IP address') }}

+
+ +
+
+
+ {{ input_csrf_token() }} + +
+ {{ display_wblist_rdns(values=whitelists, + html_input_name='whitelists', + label=_('Whitelists')) }} + + {{ display_wblist_rdns(values=blacklists, + html_input_name='blacklists', + label=_('Blacklists')) }} +
+ + {{ display_wblist_rdns_formats() }} +
+ + {{ input_submit() }} +
+
{# box-wrap #} +
{# box-body #} +
{# content-box #} +{% endblock main %} diff --git a/templates/default/layout.html b/templates/default/layout.html new file mode 100644 index 0000000..5852a3b --- /dev/null +++ b/templates/default/layout.html @@ -0,0 +1,231 @@ +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import load_jquery %} + + + + + + {% block title %}{%endblock%} + + {# CSS #} + + + + + + + + +
+
{# -- head layout -- #} +
+
+ + +
+ + {{ _('Logged in as %s') |format(session.get('username')) }} + + {{ _('Export all managed accounts') }}
+ + {% if session.get('is_global_admin') %} + + {{ _('Export statistics of admins') }} + {% endif %} +
+
+
+ + +
+ + + +
+
+ + {% block breadcrumb %}{% endblock %} + +
+
+
+ {# Main page content #} + {% block main %}{% endblock %} + +
{# -- End .page .clear -- #} +
{# -- End .main-wrap -- #} +
{# -- End .main .pagesize -- #} + + {# Basic javascript functions. #} + + + {#-- Load jQuery --#} + {% block js %} + {{ load_jquery() }} + {% endblock js %} + + {% block extra_js %}{% endblock extra_js %} + + diff --git a/templates/default/layout_user.html b/templates/default/layout_user.html new file mode 100644 index 0000000..9a57186 --- /dev/null +++ b/templates/default/layout_user.html @@ -0,0 +1,135 @@ +{% from "macros/general.html" import load_jquery %} + + + + + + {% block title %}{%endblock%} + + {# CSS #} + + + + + + + + +
+
{# -- head layout -- #} + + + + +
+
+ + {% block breadcrumb %}{% endblock %} + +
+
+
+ {# Main page content #} + {% block main %}{% endblock %} + +
{# -- End .page .clear -- #} +
{# -- End .main-wrap -- #} +
{# -- End .main .pagesize -- #} + + {# Page footer #} + {% block footer %} + + {% endblock footer %} + + {#-- Basic javascript functions. --#} + + + {#-- Load jQuery --#} + {% block js %} + {{ load_jquery() }} + {% endblock js %} + + {% block extra_js %}{% endblock extra_js %} + + diff --git a/templates/default/login.html b/templates/default/login.html new file mode 100644 index 0000000..809c052 --- /dev/null +++ b/templates/default/login.html @@ -0,0 +1,85 @@ + + + + + + + {{ _('Login to manage your mail domains & accounts') |title }} + + + + + + + + + + +{# + @languagemaps language maps +#} + +{% from "macros/msg_handlers.html" import login_msg_handler with context %} + + + +
+
+ +
+
+ + diff --git a/templates/default/macros/amavisd.html b/templates/default/macros/amavisd.html new file mode 100644 index 0000000..d68ea71 --- /dev/null +++ b/templates/default/macros/amavisd.html @@ -0,0 +1,453 @@ +{% from "macros/form_inputs.html" import input_csrf_token with context %} +{% from "macros/msg_handlers.html" import general_info with context %} + +{% macro display_amavisd_quarantined_mails(records, + account=None, + account_type=None, + show_link_for_email=true, + show_sender=true, + show_recipient=true, + sort_by_score=false) -%} + + {% set current_url = ctx.home + ctx.path %} + {% if '/page/' in current_url %} + {% set current_url = current_url.split('/page/', 0)[0] %} + {% endif %} + + + + + + + + {% if show_sender %} + + {% endif %} + + {% if show_recipient %} + + {% endif %} + + + + {% if sort_by_score %} + + {% else %} + + {% endif %} + + + + + + + {% if records %} + {% for r in records %} + {% set sender = r.sender_email |e %} + {% set recipient = r.recipient |e %} + {% set mailid_orig = r.mail_id |string |e %} + {% set mailid_for_js = mailid_orig.replace('+', '') %} + + + + + {% if show_sender %} + + {% endif %} + + {% if show_recipient %} + + {% endif %} + + {% if r.content in ['S', 's', 'Y'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% elif r.content in ['V'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% elif r.content in ['B'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% elif r.content in ['H'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% elif r.content in ['M'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% elif r.content in ['C'] %} + {% if account_type in ['user', 'domain'] %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} + + + + + + + {% endfor %} + {% else %} + {% set colspan = 8 %} + {% if not show_sender %} + {% set colspan = colspan - 1 %} + {% endif %} + {% if not show_recipient %} + {% set colspan = colspan - 1 %} + {% endif %} + + + + + {% endif %} + +
{{ _('Subject') }}{{ _('Sender') }}{{ _('Recipient') }}{{ _('Kind') }}{{ _('Size') }}{{ _('Score') }}{{ _('Score') }}{{ _('Date') }}
{{ r.subject |e |cut_string(length=50) }} + {% if show_link_for_email %} + {{ sender }} + {% else %} + {{ sender }} + {% endif %} + + {% if show_link_for_email %} + {{ recipient }} + {% else %} + {{ recipient }} + {% endif %} + {{ _('Spam') }}{{ _('Spam') }}{{ _('Virus') }}{{ _('Virus') }}{{ _('Spam') }}{{ _('Banned') }}{{ _('Bad Header') }}{{ _('Bad Header') }}{{ _('Bad Mime') }}{{ _('Bad Mime') }}{{ _('Clean') }}{{ _('Clean') }}{{ r.content }}{{ r.size |file_size_format |e }}{{ r.spam_level |e }}{{ r.time_num | epoch_seconds_to_gmt | utc_to_timezone(timezone=session['timezone']) }}more
{{ _('No quarantined mails.') }}
+ +{%- endmacro %} + + +{% macro display_search_modal() -%} + +{%- endmacro %} + + +{% macro display_idtabs_of_maillog(log_type, account_type, account) -%} + {% if session.get('amavisd_enable_logging') and (session.get('disable_viewing_mail_log') is not sameas true) %} + {% if account_type is sameas none %} +
  • {{ _('Sent Mails') }}
  • +
  • {{ _('Received Mails') }}
  • + + {% else %} +
  • {{ _('Sent Mails') }}
  • +
  • {{ _('Received Mails') }}
  • + {% endif %} + {% endif %} + + {% if session.get('amavisd_enable_quarantine') and (session.get('disable_managing_quarantined_mails') is not sameas true) %} + {% if account_type is sameas none %} +
  • {{ _('Quarantined Mails') }}
  • + {% else %} +
  • {{ _('Quarantined Mails') }}
  • + {% endif %} + {% endif %} +{%- endmacro %} + + +{% macro display_icon_of_account_profile(account_type, account) -%} + {% if account_type is not sameas none %} + + + + {% endif %} +{%- endmacro %} + +{% macro display_spam_policy(account_type, spampolicy, custom_ban_rules=None, global_spam_score=6) -%} + + {% if spampolicy %} + {% set policy_is_empty = False %} + {% else %} + {% set policy_is_empty = True %} + {% endif %} + + {% set _bypass_spam_checks = spampolicy.get('bypass_spam_checks') %} + {% set _bypass_virus_checks = spampolicy.get('bypass_virus_checks') %} + {% set _bypass_header_checks = spampolicy.get('bypass_header_checks') %} + {% set _bypass_banned_checks = spampolicy.get('bypass_banned_checks') %} + + {% set _spam_lover = spampolicy.get('spam_lover') %} + {% set _virus_lover = spampolicy.get('_virus_lover') %} + {% set _banned_files_lover = spampolicy.get('banned_files_lover') %} + {% set _bad_header_lover = spampolicy.get('bad_header_lover') %} + + {% set _spam_quarantine_to = spampolicy.get('spam_quarantine_to') %} + {% set _virus_quarantine_to = spampolicy.get('virus_quarantine_to') %} + {% set _banned_quarantine_to = spampolicy.get('banned_quarantine_to') %} + {% set _bad_header_quarantine_to = spampolicy.get('bad_header_quarantine_to') %} + {% set _banned_rulenames = [] %} + + {# banned_rulenames could be whitespace-separated or comma-separated, we use comma-separated syntax but try to support comma-separated too. #} + {# replace whiltespace by comma first, then split by comma #} + {% set _sql_banned_rulenames = spampolicy.get("banned_rulenames", "") %} + {% if _sql_banned_rulenames %} + {% set _banned_rulenames = _sql_banned_rulenames.replace(" ", ",").split(",") %} + {% endif %} + + {% if not spampolicy %} + {{ general_info(msg=_('Account does not have specific spam policy yet, server-wide policy will be applied.'), removable=false, trusted=true) }} + {% endif %} + + {% if not custom_ban_rules %} + {% set custom_ban_rules = {} %} + {% endif %} + + {# @spampolicy: sql record of `amavisd.policy` #} +
    +
    +
    +

    {{ _('Spam checking') }}

    +
    + + +
    +
    + +
    +

     

    +
    + + +
    +
    + +
    +

    {{ _('Virus checking') }}

    +
    + + +
    +
    +
    +

     

    +
    + + +
    +
    + +
    +

    {{ _('Bad-header checking') }}

    +
    + + +
    +
    +
    +

     

    +
    + + +
    +
    + +
    +

    {{ _('Banned file type checking') }}

    +
    + + +
    +
    +
    +

     

    +
    + + +
    +
    +
    + + {% if not policy_is_empty %} +
    + +
    {# col1-3 #} + {% endif %} +
    + +
    +
    +
    +
    +

    {{ _('Ban rules') }}

    +
    + + +
    +
    + + {% for (_name, _comment) in [("ALLOW_MS_WORD", _("Allow Microsoft Office Word documents")), + ("ALLOW_MS_EXCEL", _("Allow Microsoft Office Excel documents")), + ("ALLOW_MS_PPT", _("Allow Microsoft Office PowerPoint documents"))] %} +
    +

     

    +
    + + +
    +
    + {% endfor %} + + {% for _name in custom_ban_rules %} +
    +

     

    +
    + + +
    +
    + {% endfor %} +
    {# .col2-3 #} +
    + +
    {# col1-3 #} +
    {# .columns #} + +
    +
    +
    + {% if backend != 'pgsql' %} +
    +

    {{ _('Prefix text [SPAM] to the subject of spam') }}

    +
    + +
    +
    + {% endif %} + +
    +

    {{ _('Mark mail as spam when score is >=') }}

    +
    + + {% if not global_spam_score %} + {% set global_spam_score = 6 %} + {% endif %} + + +
    +
    + +
    +

    {{ _('Block or quarantine marked spam when score is >=') }}

    +
    + + {% if not global_spam_kill_score %} + {% set global_spam_kill_score = 6.9 %} + {% endif %} + + +
    +
    + + {% if session.get('is_global_admin') %} + {% if account_type == 'global' %} +
    +

    {{ _('Always insert X-Spam-* headers') }}

    +
    + +
    +
    + {% endif %} + {% endif %} +
    {# col2-3 #} + +
    +
    +
      +
    • {{ _('If many clean mails were marked as spam, please slightly increase the score.') }}
    • +
    • {{ _('If many spam message were not classified, please slightly decrease the score.') }}
    • +
    +
    +
    {# col1-3 #} +
    +{%- endmacro %} diff --git a/templates/default/macros/form_inputs.html b/templates/default/macros/form_inputs.html new file mode 100644 index 0000000..612c1a2 --- /dev/null +++ b/templates/default/macros/form_inputs.html @@ -0,0 +1,205 @@ +{% macro input_csrf_token(token=none) -%} + {% if token is sameas none %} + {% set token = csrf_token() %} + {% else %} + {% set token = token |e %} + {% endif %} + + + +{%- endmacro %} + + +{% macro input_text(label, + input_name, + value=None, + required=False, + multivalue=False, + multivalue_parent_css_id=None, + enable_input=true, + comment=none, + comment_as_tooltip=false, + comment_as_text=false, + size=35, + maxlength=0) -%} + {% if not value %} + {% set value = '' %} + {% endif %} + +
    +

    {{ label }}{% if required %}*{% endif %}

    + {% if enable_input %}{% if multivalue %}{% endif %}{% endif %} + + {% if comment %} + {% if comment_as_tooltip %} + + {% elif comment_as_text %} + {{ comment |e }} + {% else %} + {{ comment |e }} + {% endif %} + {% endif %} +
    +{%- endmacro %} + + +{% macro input_radios(label, + input_name, + options, + value=None, + required=False, + comment=none, + comment_as_tooltip=false, + enable_input=true) -%} + {# + `options` must be a list with 2-element tuples: + + [('', '', ''), ...] + #} + {% if not value %} + {% set value = '' %} + {% endif %} + + {% for (_opt_value, _opt_desc) in options %} +
    +

    + {%- if loop.first -%} + {{ label }} + {%- if required -%}*{%- endif -%} + + {%- if comment -%} + {%- if comment_as_tooltip -%} +   + + {%- else -%} + {{ comment |e }} + {%- endif -%} + {%- endif -%} + {% else %} +   + {%- endif -%} +

    + +
    + {% if _opt_desc %} {{ _opt_desc |e }}{% endif %} +
    +
    + {% endfor %} +{% endmacro %} + + +{% macro input_checkbox(label, + input_name, + checked=false, + required=false, + enable_input=true, + comment=none, + comment_as_tooltip=false, + add_hidden_input=false) -%} +
    +

    {% if label %}{{ label }}{% else %} {% endif %}{% if required %}*{% endif %}

    + + + {% if comment %} + {% if comment_as_tooltip %} + + {% else %} + {{ comment |e }} + {% endif %} + {% endif %} + + {% if add_hidden_input %} + + {% endif %} +
    +{% endmacro %} + +{% macro input_textarea(label, + input_name, + value=None, + comment=None, + is_list_of_emails=False, + is_list_of_ip_or_network=False, + required=False, + enable_input=true, + rows=4, + cols='50%') -%} + {% if not value %} + {% set value = '' %} + {% endif %} + +
    +

    {{ label }}{% if required %}*{% endif %}

    + {% if is_list_of_emails %} + {{ _('One mail address per line. Invalid address will be discarded.') }} + {% elif is_list_of_ip_or_network %} + {{ _('One IP address or network per line. Invalid address or network will be discarded.') }} + {% endif %} + +
    +{%- endmacro %} + +{% macro input_select(label, input_name, options, value=none, offer_none=false) -%} +
    +

    {% if label %}{{ label |e }}{% else %} {% endif %}

    + + +
    +{% endmacro %} + + +{% macro input_submit(label=none, + name=none, + color='green', + float=none) -%} +
    +
    +

     

    + + + +
    +{%- endmacro %} diff --git a/templates/default/macros/general.html b/templates/default/macros/general.html new file mode 100644 index 0000000..5ff2ad9 --- /dev/null +++ b/templates/default/macros/general.html @@ -0,0 +1,2450 @@ +{% from "macros/form_inputs.html" import + input_text, + input_csrf_token + with context + %} + +{# ------------ Load JS files ------------- #} +{% macro load_jquery() -%} + + + + + + + + + +{%- endmacro %} +{# ------------ END JS ------------- #} + +{% macro display_remove_mailbox_days(num) -%} + {% if num == 0 %} + {{ _('Keep mailbox forever') }} + {% elif num == 1 %} + {{ _('Keep mailbox for 1 day') }} + {% elif 1 < num < 30 %} + {% if num == 7 %} + {{ _('Keep mailbox for 1 week') }} + {% else %} + {% set _div = num % 7 %} + {% if _div == 0 %} + {{ _('Keep mailbox for %d weeks') | format(num/7) }} + {% else %} + {{ _('Keep mailbox for %d days') | format(num) }} + {% endif %} + {% endif %} + {% elif num == 30 %} + {{ _('Keep mailbox for 1 month ') }} + {% elif 30 < num < 365 %} + {% set _div = num % 30 %} + {% if _div == 0 %} + {{ _('Keep mailbox for %d months') | format(num/30) }} + {% else %} + {{ _('Keep mailbox for %d days') | format(num) }} + {% endif %} + {% elif num == 365 %} + {{ _('Keep mailbox for 1 year') }} + {% else %} + {# num > 365 #} + {% set _div = num % 365 %} + {% if _div == 0 %} + {{ _('Keep mailbox for %d years') | format(num / 365) }} + {% endif %} + {% endif %} +{% endmacro %} + +{%- macro display_subnav(crumbs) -%} + {# Crumb format: (link, label), ('active', link, label) #} + {% if crumbs %} + + {% endif %} +{%- endmacro -%} + + +{% macro set_account_status_img(status, + account_type='user', + is_relay=false, + relay='', + is_backupmx=false, + backupmx='', + float="right", + tooltip=true, + vcenter=true) -%} + {# @relay is required if status == 'relay' #} + {% if float == 'right' %} + {% set imgfloat = 'fr-space' %} + {% elif float == 'left' %} + {% set imgfloat = 'fl-space' %} + {% elif float == 'center' %} + {% set imgfloat = 'fl-space' %} + {% else %} + {% set imgfloat = '' %} + {% endif %} + + {% if is_relay in ['1', 1, true] %} + {% set is_relay = true %} + {% else %} + {% set is_relay = false %} + {% endif %} + + {% if is_backupmx in ['yes', '1', 1, true] %} + {% set is_backupmx = true %} + {% else %} + {% set is_backupmx = false %} + {% endif %} + + {% if status in ['active', '1', 1] %} + {% if is_backupmx %} + {{ _('Backup MX') }} + {% elif is_relay %} + {{ _('Relay') }} + {% else %} + + {% endif %} + {% else %} + + {% endif %} +{%- endmacro %} + + +{% macro set_user_admin_type_img(value) -%} + {# :param value in [domainadmin, globaladmin] #} + {% if value == 'domainadmin' %} + + {% elif value == 'globaladmin' %} + + {% endif %} +{%- endmacro %} + +{% macro set_admin_type_img(value, hide_negative=true) -%} + {% if value == 'yes' %} + + {% else %} + {% if hide_negative is not sameas true %} + + {% endif %} + {% endif %} +{%- endmacro %} + +{% macro set_alias_domain_img(alias_domains=None) -%} + {% if alias_domains %} + A{{ alias_domains |length }} + + {% endif %} +{%- endmacro %} + +{% macro set_member_of_mailing_list_img(user, addresses=None) -%} + {% if addresses %} + L{{ addresses |length }} + + {% endif %} +{%- endmacro %} + +{% macro set_forwarding_address_img(user, addresses=None) -%} + {% if addresses %} + {% set total = addresses | length %} + + {% if user in addresses %} + {% set total = (addresses | length) - 1 %} + {% set title = _('Forwarding addresses (saved a copy in mailbox)') %} + {% else %} + {% set title = _('Forwarding addresses (without saving a copy in mailbox)') %} + {% endif %} + + {% if total > 0 %} + F{{ total }} + + {% endif %} + {% endif %} +{%- endmacro %} + +{% macro set_alias_address_img(addresses=None) -%} + {% if addresses %} + A{{ addresses |length }} + + {% endif %} +{%- endmacro %} + +{% macro set_assigned_groups_img(addresses=None) -%} + {% if addresses %} + G{{ addresses |length }} + + {% endif %} +{%- endmacro %} + +{% macro set_account_activity_img(activity, account_type, account, float=true) -%} + {% if session.get('amavisd_enable_logging') and (session.get('disable_viewing_mail_log') is not sameas true) %} + + + + {% else %} + {# Return a char (white space) to pretty html display. (required) #} +   + {%- endif -%} +{%- endmacro %} + + +{% macro display_progress_bar(percent, + tooltip=none, + show_zero=false, + style='normal', + width='100%') -%} + {% set percent = percent |int %} + {% if percent < 0 %} + {% set percent = 0 %} + {% elif percent > 100 %} + {% set percent = 100 %} + {% endif %} + + {% if tooltip is sameas none %} + {% set title = percent |string + '%' %} + {% else %} + {% set title = tooltip |string + ' (' + percent | string + '%)' %} + {% endif %} + + {% if style == 'thin' %} + {% set height = '3px' %} + {% else %} + {% set height = '1.6em' %} + {% endif %} + + {% if percent < 80 %} + {% set bgcolor = '#ACE97C' %} + {% elif 80 <= percent < 90 %} + {% set bgcolor = 'yellow' %} + {% elif 90 <= percent < 99 %} + {% set bgcolor = '#F76541' %} + {% else %} + {% set bgcolor = '#F62217' %} + {% endif %} + + {% if percent > 0 or show_zero %} +
    +
    +
    + {% endif %} +{%- endmacro %} + + +{% macro display_filter_by_first_char(baseurl, + first_char=None, + account_type='user', + disabled_only=False, + available_chars=None, + separator='?starts_with=') -%} +
    + + + {% if not available_chars %} + {% set available_chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', + 'U', 'V', 'W', 'X', 'Y', 'Z'] %} + {% endif %} + + {% for char in available_chars %} + {{char}} + {% endfor %} + + {% if account_type in ['domain', 'user', 'maillist', 'alias'] %} + | {{ _('Disabled') }} + {% endif %} +
    +{%- endmacro %} + +{% macro display_input_mail(mail='', name='mail', required=false) -%} + {{ input_text(label=_('Mail Address'), + input_name=name, + value=mail, + required=required) }} +{%- endmacro %} + +{% macro display_input_domain(domain='', name='domainName', required=false, enable_input=true) -%} + {{ input_text(label=_('Domain Name'), + input_name=name, + value=domain, + required=required, + enable_input=enable_input) }} +{%- endmacro %} + +{% macro display_input_employeeid(value=None) -%} + {{ input_text(label=_('User/Employee ID'), + input_name='employeeNumber', + value=value) }} +{%- endmacro %} + +{% macro display_input_mobile(value=None) -%} + {{ input_text(label=_('Mobile'), + input_name='mobile', + value=value) }} +{%- endmacro %} + +{% macro display_phone_numbers(phone_numbers=None) -%} + {% if not phone_numbers %} +
    +

    {{ _('Telephone Number') }}

    + + + +
    + {% else %} + {% for phone in phone_numbers %} +
    + {% if loop.first %} +

    {{ _('Telephone Number') }}

    + {% else %} +

     

    + {% endif %} + + + +
    + {% endfor %} + {% endif %} + + {#-- Always display one more field to input new value --#} +
    +

     

    + + + +
    +{%- endmacro %} + +{% macro display_preferred_language(value='', languagemaps=['en_US'], label=none, enable_input=true) -%} +
    + {% if label is sameas none %} +

    {{ _('Preferred language') }}

    + {% else %} +

    {{ label }}

    + {% endif %} + +
    +{%- endmacro %} + +{% macro display_timezones(value, timezones) -%} + {% if not timezones %} + {% set timezones = {} %} + {% endif %} + +
    +

    {{ _('Time zone') }}

    + +
    +{%- endmacro %} + +{% macro display_in_global_address_book(enabled_services=None) %} + {% if not enabled_services %} + {% set enabled_services = [] %} + {% endif %} + +
    +

    {{ _("Show in Global Address Book") }}

    +
    + +
    +
    +{%- endmacro %} + + +{% macro display_input_global_admin(value='no') %} +
    +

    {{ _('Mark as global admin') }}

    +
    + {# + ldap: yes, no + mysql: true, false + #} + + + +
    +
    +{%- endmacro %} + + +{% macro display_domain_creation_options_of_normal_admin(admin_settings=None, disabled_services=None) %} + {# Options for normal domain admin #} + {% if session.get('is_global_admin') %} + + {% if not admin_settings %} + {% set admin_settings = {} %} + {% endif %} + + {% if not disabled_services %} + {% set disabled_services = [] %} + {% endif %} + +
    +

    {{ _('Privileges') }}

    +
    + + {{ _('Disallow to view log of inbound/outbound mails') }} + +
    + +

     

    +
    + + {{ _('Disallow to manage quarantined mails') }} + +
    + +
    +
    +

    {{ _('Create new mail domains with up to') }}

    + +
    + + {{ _('Domains') }} + +
    + +

     

    +
    + + + + {% set _quota_unit = admin_settings.get('create_quota_unit', 'TB') %} + + + {{ _('Mailbox Quota') }} + +
    + +

     

    +
    + + {{ _('Mail Users') }} + +
    + +

     

    +
    + + {{ _('Mail Aliases') }} + +
    + +

     

    +
    + + {{ _('Mailing Lists') }} + +
    + +

     

    +
    + + {{ _('No need to verify ownership for new domain') }} + +
    +
    + + {% endif %} +{% endmacro %} + + +{% macro display_mark_user_as_admin(is_domain_admin=false, + is_global_admin=false, + allowed_to_grant_admin='no', + user_settings=None, + disabled_services=None) %} + {# + @is_domain_admin: 0, 1 (SQL), or true, yes, false, no (LDAP) + @is_global_admin: 0, 1 (SQL), or true, yes, false, no (LDAP) + @allowed_to_grant_admin: 'yes', 'no', None, none + @user_settings: a dict of per-user account settings. + @disabled_services: a list/tuple/set of disabled service names, + used for LDAP backends (usually its value of LDAP + attribute 'disabledService'). + #} + {% if not user_settings %} + {% set user_settings = {} %} + {% endif %} + + {% if not disabled_services %} + {% set disabled_services = [] %} + {% endif %} + +
    +

    {{ _('Mark this user as') }}

    + {% if session.get('is_global_admin') %} +
    + + {{ _('Global admin') }} + + {{ _('Note: Global admin can manage all mail domains.') }} +
    + +

     

    + {% endif %} + +
    + + {{ _('Domain admin') }} + + {{ _('Please choose managed domains below.') }} +
    + +

     

    +
    +   |-- + {{ _('Disallow to view log of inbound/outbound mails') }} + +
    + +

     

    +
    +   |-- + {{ _('Disallow to manage quarantined mails') }} + +
    + +

     

    +
    + {% if allowed_to_grant_admin in ['yes', true] %} + + {% endif %} + +   |-- + {{ _('Allow this admin to mark other mail user as domain admin') }} + +
    + + {# + # Options for normal domain admin + #} + {% if session.get('is_global_admin') %} +

     

    +
    +   |-- + {{ _('Allow this admin to create new mail domains with up to') }} + +
    + +

     

    +
    +         |-- + {{ _('No need to verify ownership for new domain') }} + +
    + +

     

    +
    +         |-- + {{ _('Domains') }} + +
    + +

     

    +
    +         |-- + + + {% set _quota_unit = user_settings.get('create_quota_unit', 'TB') %} + + + {{ _('Mailbox Quota') }} + +
    + +

     

    +
    +         |-- + {{ _('Mail Users') }} + +
    + +

     

    +
    +         |-- + {{ _('Mail Aliases') }} + +
    + + {% endif %} + +
    +{%- endmacro %} + + +{# Used to display domainMaxXXXNumber #} +{% macro display_number_of_account_limited(value, hide_unlimited=true, hide_slash=false) -%} + {% if value == '0' or value == 0 or value == 'None' %} + {% if hide_unlimited is not sameas true %} + {% if hide_slash is not sameas true %}/{% endif %}{{ _('Unlimited') }} + {% endif %} + {%else%} + {% if hide_slash is not sameas true %}/ {% endif %}{{ value |e }} + {%endif%} +{%- endmacro %} + + +{# Display accountStatus #} +{% macro display_account_status(status, + account_type='user', + last_login_epoch_seconds=None, + last_login_service=None) %} +
    + {% if account_type == 'domain' %} +

    {{ _('Enable this domain') }}

    + {% else %} +

    {{ _('Enable this account') }}

    + {% endif %} + +
    + {% if last_login_epoch_seconds %} {{ _('Last Login:') }} {{ last_login_epoch_seconds | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }}{% if last_login_service %} ({{ last_login_service | upper }}){% endif %}{% endif %} +
    +
    +{%- endmacro %} + +{% macro display_domain_backupmx(domain, backupmx=false, transport='') %} + {% set is_real_backupmx = false %} + {% if backupmx in [true, 'yes', 1, '1'] and transport.startswith('relay:') %} + {% set is_real_backupmx = true %} + {% endif %} + +
    +
    +
    +

    {{ _('Mark as backup MX') }}

    +
    + +
    +
    + + {% if transport.startswith('relay:') %} + {% if transport == 'relay:' + domain %} + {% set primary_mx = '' %} + {% else %} + {% set primary_mx = transport.lstrip('relay:') %} + {% endif %} + {% else %} + {% set primary_mx = '' %} + {% endif %} + +
    +

    {{ _('Primary MX') }}

    +
    + +
    +
    +
    {# .col2-3 #} + +
    + + +
    +
      +
    • {{ _('When smtp service on primary MX mail server is down, emails sent to this domain will be delivered to backup MX server.') }}
    • +
    • {{ _('Received emails on backup MX will be relayed to primary MX server when its smtp service is back online.') }}
    • +
    +
    +
    {#-- .col1-3 --#} + + +
    {# .columns #} +{%- endmacro %} + +{% macro display_reset_password(show_oldpw=false, + show_confirmpw=true, + min_passwd_length='0', + max_passwd_length='0', + store_password_in_plain_text=false, + enable_input=true) -%} + {% set min_passwd_length = min_passwd_length | string %} + {% set max_passwd_length = max_passwd_length | string %} + + {% if min_passwd_length != '0' and max_passwd_length != '0' %} + {% set pw_hint = _('Must be %s - %s characters.') |format(min_passwd_length, max_passwd_length) %} + {% elif min_passwd_length != '0' and max_passwd_length == '0' %} + {% set pw_hint = _('At least %s characters.') |format(min_passwd_length) %} + {% elif max_passwd_length == '0' and max_passwd_length != '0' %} + {% set pw_hint = _('No more than %s characters.') |format(max_passwd_length) %} + {% else %} + {% set pw_hint = '' %} + {% endif %} + + {% if show_oldpw %} +
    +

    {{ _('Old password') }} *

    + + + +
    + {% endif %} + +
    +

    {{ _('New password') }} *

    + + + + {% if pw_hint != '' %} + {{ pw_hint }} + {% endif %} +
    + + {% if show_confirmpw %} +
    +

    {{ _('Confirm new password') }} *

    + + + +
    + {% endif %} + + {% if store_password_in_plain_text %} +
    +

    {{ _('Store password in plain text') }}

    + +
    + {% endif %} +{%- endmacro %} + +{% macro display_quota(value='', + label='', + comment='', + used_quota=0, + stored_messages=0, + spare_quota_bytes=0, + show_spare_quota=false, + show_value_in_input=true, + hide_zero=true, + show_used_quota=false, + enable_input=true) -%} + {# Convert to string #} + {% set used_quota = used_quota |string %} + + {% if spare_quota_bytes > 0 %} + {% if value > spare_quota_bytes/1024/1024 %} + {% set value = spare_quota_bytes/1024/1024 %} + {% endif %} + {% endif %} + {% set value = value |string %} + + {% if hide_zero %} + {% if value == '0' %} + {% set value = '' %} + {% endif %} + {% endif %} + +
    + {% if label == '' %} +

    {{ _('Mailbox Quota') }}

    + {% else %} +

    {{ label |e }}

    + {% endif %} + +
    + + + + {% if show_used_quota %} + {% if (value |int) > 0 %} + {% if session.get('show_used_quota') and value.isdigit() and used_quota.isdigit() %} + {% set percent = used_quota |convert_to_percentage(value |int * 1024 * 1024) %} + + {% if (stored_messages | int) > 0 %} + + {% else %} + + {% endif %} + {% endif %} + {% elif (value | int) == 0 %} + {% if (stored_messages | int) > 0 %} + + {% endif %} + {% endif %} + {% endif %} +
    +
    +{%- endmacro %} + +{% macro display_user_forwarding(mail, enabled=0, forwarding_addresses=None) %} + +{% if not forwarding_addresses %} + {% set forwarding_addresses = [] %} +{% endif %} + +{% if enabled is not sameas none %} +
    +

    {{ _('Enable mail forwarding') }}

    + + + +
    +{% endif %} + +
    +

    {{ _('Save a copy in mailbox') }}

    + + + +
    + +
    +

    {{ _('Forward mails to address') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    +{%- endmacro %} + +{% macro display_relay(transport='', + default_mta_transport='dovecot', + account_type='domain', + url='', + is_backupmx=false) -%} + {# transport 'relay:[IP]:port' is used for backup mx #} + {# @url is required when (account_type == 'user'), link to domain relay setting #} + + {% if is_backupmx in [true, 'yes', 1, '1'] %} + {% set is_backupmx = true %} + {% else %} + {% set is_backupmx = false %} + {% endif %} + + {# Check whether this is a real backup mx #} + {% set is_real_backupmx = false %} + {% if is_backupmx and transport.startswith('relay:') %} + {% set is_real_backupmx = true %} + {% endif %} + +
    +
    +
    +

    {{ _('Relay received email to') }}

    +
    + + + {% if is_real_backupmx %} + + {% endif %} +
    +
    + + {% if account_type == 'domain' %} + {% set relay_without_verify_local_recipient = false %} + {% if is_backupmx %} + {% if transport.startswith('smtp:') or transport.startswith(':') or transport.startswith('uucp:') %} + {% set relay_without_verify_local_recipient = true %} + {% endif %} + {% endif %} + +
    +

    {{ _('Relay without verifying local recipients') }}

    +
    + +
    +
    + {% endif %} +
    + + + + + +
    +{%- endmacro %} + + +{% macro display_sender_relayhost(relayhost=None) %} +
    +
    +
    +

    {{ _('Relay outgoing email to') }}

    +
    + +
    +
    +
    + + + + + +
    +{%- endmacro %} + +{% macro display_recipient_bcc(address='', label='', input_name='recipientBccAddress') -%} + {% if not address %} + {% set address = '' %} + {% endif %} + + {% if not label %} + {% set label = _('BCC incoming emails to other address') %} + {% endif %} +
    +

    {{ label }}

    + + + +
    +{%- endmacro %} + +{% macro display_sender_bcc(address='', label='', input_name='senderBccAddress') -%} + {% if not address %} + {% set address = '' %} + {% endif %} + + {% if not label %} + {% set label = _('BCC outgoing emails to other address') %} + {% endif %} + +
    +

    {{ label }}

    + + + +
    +{%- endmacro %} + +{% macro display_domain_cn(cn='', input_name='cn', enable_input=true) -%} + {% if cn in [None, 'None'] %} + {% set cn = '' %} + {% endif %} + +
    +

    {{ _('Company/Organization Name') }}

    + + + + +
    +{% endmacro %} + +{% macro display_input_cn(value='', + input_name='cn', + account_type='user', + tooltip='', + size="size-250", + show_first_last_name=false, + first_name='', + last_name='', + email='', + empty_if_equal_to_username=true, + enable_input=true) -%} + {% if value is sameas none %} + {% set value = '' %} + {% endif %} + + {% if account_type == 'user' and mail %} + {% set username = email.split('@', 1)[0] %} + {% if value == username and empty_if_equal_to_username %} + {% set value = '' %} + {% endif %} + + {% if first_name == username and empty_if_equal_to_username %} + {% set first_name = '' %} + {% endif %} + + {% if last_name == username and empty_if_equal_to_username %} + {% set last_name = '' %} + {% endif %} + {% endif %} + +
    +

    {{ _('Display Name') }}

    + + + + +
    + + {% if show_first_last_name %} +
    +

     

    +
    + + +
    +
    + {% endif %} +{%- endmacro %} + + +{% macro display_add_admin(min_passwd_length='0', max_passwd_length='0', lang='en_US', languagemaps=['en_US']) -%} + {{ display_input_mail(required=true) }} + +
     
    + + {{ display_reset_password(show_confirmpw=true, + min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length) }} + +
    + {{ display_input_cn() }} + {{ display_preferred_language(lang, languagemaps) }} + +
    + {{ display_input_global_admin() }} +{%- endmacro %} + +{# quota must be in MB #} +{% macro display_domain_quota(quota=0, + required=False, + num_allocated_quota=0, + num_max_quota=0, + num_spare_quota=0, + enable_input=true) -%} + {% set quota_in_mb = quota %} + + {% if num_max_quota < num_allocated_quota %} + {% set enable_input = false %} + {% endif %} + + {# required, allocated, max are used by normal domain admin #} + {% if quota_in_mb >= (1024 * 1024) and quota_in_mb % (1024*1024) == 0 %} + {% set quota = (quota_in_mb / (1024*1024)) | int %} + {% set quota_unit = 'TB' %} + {% elif quota_in_mb >= 1024 and quota_in_mb % 1024 == 0 %} + {% set quota = (quota_in_mb / 1024) | int%} + {% set quota_unit = 'GB' %} + {% else %} + {% set quota = quota |int %} + + {% if quota == 0 %} + {# defaults to GB to avoild one more click #} + {% set quota_unit = 'GB' %} + {% else %} + {% set quota_unit = 'MB' %} + {% endif %} + {% endif %} + +
    +

    + {{ _('Domain quota size') }} + + {% if required -%} + * + {%- endif %} +

    + + + + + + + {% if num_max_quota %} + {% if num_max_quota < num_allocated_quota %} + {{ _('Exceeded:') }} {{ (num_allocated_quota - num_max_quota) | file_size_format(base_mb=True) }} + {% else %} + {{ _('Max:') }} {{ (quota_in_mb + num_spare_quota) | file_size_format(base_mb=True) }} ({{ quota_in_mb + num_spare_quota }} MB) + {% endif %} + {% endif %} + +
    +{% endmacro %} + +{% macro display_domain_default_userquota(quota=0, enable_input=true, max_user_quota=0) %} +
    +

    {{ _('Default quota of new user') }}

    + + + + + {% if not session.get('is_global_admin') %} + {% if max_user_quota > 0 %} + ({{ _('Max:') }} {{ max_user_quota }} MB) + {% endif %} + {% endif %} +
    +{% endmacro %} + +{# quota in MB #} +{% macro display_domain_max_user_quota(quota=0, enable_input=true) %} + {% if quota >= 1024 * 1024 and quota % 1024 == 0 %} + {% set quota = (quota / (1024*1024)) | int %} + {% set quota_unit = 'TB' %} + {% elif 1024*1024 > quota >= 1024 and quota % 1024 == 0 %} + {% set quota = (quota / 1024) | int %} + {% set quota_unit = 'GB' %} + {% else %} + {% set quota = quota | int %} + + {% if quota == 0 %} + {# defaults to GB to avoild one more click #} + {% set quota_unit = 'GB' %} + {% else %} + {% set quota_unit = 'MB' %} + {% endif %} + {% endif %} + +
    +

    {{ _('Max quota of mail user') }}

    + + + + +
    +{% endmacro %} + +{% macro display_add_domain(label=false, + preferred_language='en_US', + languagemaps=['en_US'], + timezones=None, + create_new_domain=true, + num_max_domains=0, + num_managed_domains=0, + num_spare_domains=-1, + num_max_quota=0, + num_allocated_quota=0, + num_spare_quota=-1, + num_max_users=0, + num_allocated_users=0, + num_spare_users=-1, + num_max_aliases=0, + num_allocated_aliases=0, + num_spare_aliases=-1, + num_max_lists=0, + num_allocated_lists=0, + num_spare_lists=-1) -%} + + {% if session.get('is_global_admin') %} + {% set create_new_domain = true %} + {% endif %} + +
    + {% if label %} +

    {{ _('Add domain') }}

    + {% endif %} +
    + + {{ input_csrf_token() }} + {{ display_input_domain(required=true, enable_input=create_new_domain) }} + {{ display_domain_cn(enable_input=create_new_domain) }} + + {{ display_preferred_language(value=preferred_language, + languagemaps=languagemaps, + label=_('Default language for new user')) }} + {{ display_timezones(value=None, timezones=timezones) }} +
    + + {% if num_max_quota %} + {{ display_domain_quota(required=True, + num_allocated_quota=num_allocated_quota, + num_max_quota=num_max_quota, + num_spare_quota=num_spare_quota, + enable_input=create_new_domain) }} + {% else %} + {{ display_domain_quota(enable_input=create_new_domain) }} + {% endif %} + + {{ display_domain_default_userquota(quota='1024', enable_input=create_new_domain) }} + {{ display_domain_max_user_quota(enable_input=create_new_domain) }} + +
    + +
    +

    + {{ _('Number of max mail users') }} + + {% if num_max_users > 0 -%} + * + {% endif %} +

    + + + + {% if num_max_users > 0 %} + {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_users, num_allocated_users, num_max_users) }} + {%- endif %} + +
    + +
    +

    + {{ _('Number of max mail aliases') }} + + {% if num_max_aliases > 0 -%} + * + {% endif %} +

    + + + + {% if num_max_aliases > 0 -%} + {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_aliases, num_allocated_aliases, num_max_aliases) }} + {% endif %} + +
    + +
    +

    + {{ _('Number of max mailing lists') }} + {% if num_max_lists > 0 -%} + * + {% endif %} +

    + + + + + {% if num_max_lists > 0 -%} + {{ _('Available: %d (Existing: %d, Max: %d.)') % (num_spare_lists, num_allocated_lists, num_max_lists) }} + {% endif %} + +
    + +
    +

     

    + + + +
    +
    +{%- endmacro %} + + +{% macro display_list_access_policy_name(policy, enable_input=true) -%} + {% if policy %} + {% set policy = policy.lower() %} + {% if policy not in ['public', 'domain', 'subdomain', + 'membersonly', + 'moderatorsonly', 'allowedonly', + 'membersandmoderatorsonly'] %} + {% set policy = 'public' %} + {% endif %} + {% else %} + {% set policy = 'public' %} + {% endif %} + + {% if policy == 'public' %} + {{ _('Unrestricted') }} + {% elif policy == 'domain' %} + {{ _('Users under same domain') }} + {% elif policy == 'subdomain' %} + {{ _('Users under same domain and its sub-domains') }} + {% elif policy == 'membersonly' %} + {{ _('Members') }} + {% elif policy in ['allowedonly', 'moderatorsonly'] %} + {{ _('Moderators') }} + {% elif policy == 'membersandmoderatorsonly' %} + {{ _('Members and moderators') }} + {% else %} + {{ _('Unrestricted') }} + {% endif %} +{% endmacro %} + +{% macro display_list_access_policies(policy, + enable_members_and_moderators_only=true, + enable_input=true) -%} + {% if policy %} + {% set policy = policy.lower() %} + + {% if policy not in ['public', 'domain', 'subdomain', + 'membersonly', + 'allowedonly', 'moderatorsonly', + 'membersandmoderatorsonly'] %} + {% set policy = 'public' %} + {% endif %} + + {# Use 'moderatorsonly' instead of 'allowedonly' #} + {% if policy == 'allowedonly' %} + {% set policy = 'moderatorsonly' %} + {% endif %} + {% else %} + {% set policy = 'public' %} + {% endif %} + + {% set policies = [ + ('public', _('Unrestricted') + '. ' + _('Everyone can send mail to this address')), + ('domain', _('Users under same domain')), + ('subdomain', _('Users under same domain and its sub-domains')), + ('membersonly', _('Members')), + ('moderatorsonly', _('Moderators')), + ] + %} + + {% if enable_members_and_moderators_only %} + {% set policies = policies + [('membersandmoderatorsonly', _('Members and moderators'))] %} + {% endif %} + + {% for p in policies %} +
    + {% if not loop.first %} +

     

    + {% else %} +

    {{ _('Who can send email to this list') }}

    + {% endif %} + + + {{ p[1] }} + +
    + {% endfor %} +{% endmacro %} + + +{% macro highlight_username_in_mail(mail) -%} + {{ mail.split('@')[0] |e }}@{{ mail.split('@')[-1] |e }} +{% endmacro %} + +{%- macro display_random_password(password_length, + password_policies, + replace_ids=None, + password_last_change_date=None, + password_last_change_date_with_hour=true) -%} +
    + {% if true in password_policies.values() %} +

    {{ _('Password must contain') }}

    +
      + {% if password_policies['min_passwd_length'] %} +
    • {{ _('At least %d characters.') |format(password_policies['min_passwd_length']) }}
    • + {% endif %} + + {% if password_policies['max_passwd_length'] %} +
    • {{ _('No more than %d characters.') |format(password_policies['max_passwd_length']) }}
    • + {% endif %} + + {% if password_policies['has_letter'] %} +
    • {{ _('At least one letter') }}
    • + {% endif %} + + {% if password_policies['has_uppercase'] %} +
    • {{ _('At least one uppercase letter') }}
    • + {% endif %} + + {% if password_policies['has_number'] %} +
    • {{ _('At least one digit number') }}
    • + {% endif %} + + {% if password_policies['has_special_char'] %} +
    • {{ _('At least one special character:') }} {{ password_policies['special_characters'] |e }}
    • + {% endif %} +
    + {% endif %} + +
    + + {% set random_password = password_length | generate_random_password %} + +

    {{ _('Need a strong password?') }}

    +

    {{ random_password | e }}

    +

    + + + + {% if password_last_change_date %} +

    {{ _('Password last change:') }}

    + + {% if password_last_change_date_with_hour %} + {% set format = "%Y-%m-%d %H:%M:%S" %} + {% else %} + {% set format = "%Y-%m-%d" %} + {% endif %} + +

    {{ password_last_change_date | utc_to_timezone(timezone=session.get('timezone'), format=format) }}

    + {% endif %} + +
    +{%- endmacro -%} + +{%- macro display_disabled_account_profiles(account_type='domain', disabled_profiles=[]) -%} + +{% if account_type == 'domain' %} + {% set label = _('Disabled domain profiles') %} + {% set html_input_name = 'disabledDomainProfile' %} + {% set all_profiles = [('disabled_mail_services', _('Disabled mail services')), + ('password_policies', _('Password policies')), + ('aliases', _('Aliases')), + ('bcc', _('BCC')), + ('catchall', _('Catch-all')), + ('relay', _('Relay')), + ('backupmx', _('Backup MX')), + ('throttle', _('Throttling')), + ('wblist', _('White/Blacklist')), + ('spampolicy', _('Spam Policy')), + ] %} + + {% if session.get('iredapd_enabled') %} + {% set all_profiles = all_profiles + [('greylisting', _('Greylisting'))] %} + {% endif %} +{% elif account_type == 'user' %} + {% set label = _('Disabled user profiles') %} + {% set html_input_name = 'disabledUserProfile' %} + + {% set all_profiles = [ + ('aliases', _('Aliases')), + ('bcc', _('BCC')), + ('forwarding', _('Forwarding')), + ('relay', _('Relay')), + ('throttle', _('Throttling')), + ('wblist', _('White/Blacklist')), + ('spampolicy', _('Spam Policy')), + ] %} + + {% if session.get('iredapd_enabled') %} + {% set all_profiles = all_profiles + [('greylisting', _('Greylisting'))] %} + {% endif %} +{% elif account_type == 'user_preference' %} + {% set label = _('Disabled self-service preferences') %} + {% set html_input_name = 'disabledUserPreference' %} + + {% set all_profiles = [ + ('personal_info', _('Personal information')), + ('password', _('Change password')), + ('forwarding', _('Set mail forwarding')), + ('manageml', _('Manage moderated or owned mailing lists')), + ('wblist', _('Manage per-user white/blacklists')), + ('quarantine', _('Manage quarantined mails')), + ('rcvd_mails', _('View received mails and white/blacklist senders')), + ('spampolicy', _('Spam Policy')), + ] %} +{% endif %} + +
    +
    + {% for profile in all_profiles %} + {% if loop.first %} +

    {{ label }}

    + {% else %} +

     

    + {% endif %} + +
    + + +
    + {% endfor %} +
    {# .col2-3 #} + +
    +
    +
      + {% if account_type == 'user_preference' %} +
    • {{ _('Normal mail user cannot view and update disabled preferences.') }}
    • + {% else %} +
    • {{ _('Normal admin cannot view and update disabled profiles in account profile page.') }}
    • + {% endif %} +
    +
    +
    {# .col1-3 #} +
    {# .columns #} +{%- endmacro -%} + +{% macro show_pages(baseurl, total, cur_page, near_pages=4, sep='/page/', url_suffix='') -%} + {% if total % page_size_limit > 0 %} + {% set total_pages = total // page_size_limit + 1 %} + {% else %} + {% set total_pages = total // page_size_limit %} + {% endif %} + + {% set baseurl = baseurl |e %} + {% set sep = sep |e %} + +
    + {# Show links of 'First Page', 'Previous Page' #} + {%- if total_pages > 0 -%} + + {% if total_pages > 3 %} + {{ _('First Page') }} + {% endif %} + + {% if cur_page != 1 and cur_page != 0 %} + + {% endif %} + + {%- endif -%} + + + {% if total_pages <= near_pages %} + {# Show all cur_page numbers if total pages is less than or equal to 4 pages.#} + {% for page_no in range(1, total_pages + 1) %} + {{page_no}} + {% endfor %} + {% else %} + {# Show current cur_page number and near numbers.#} + {% if cur_page <= near_pages %} + {# Show near pages. #} + {% if total_pages - cur_page <= near_pages %} + {% set end_page = cur_page + (total_pages - cur_page) %} + {% else %} + {% set end_page = cur_page + near_pages %} + {% endif %} + + {% for page_no in range(1, end_page) %} + {% if page_no != cur_page %} + {{page_no}} + {% else %} + {{ cur_page }} + {% endif %} + {% endfor %} + + {# Show last page. #} + {% if cur_page + near_pages < total_pages %} + {% if cur_page + near_pages <= total_pages - 1 %}...{% endif %} + {% endif %} + {{total_pages}} + {% else %} + {# Show first page number. #} + {%- if cur_page - near_pages == 2 -%} + 1 + {%- elif cur_page - near_pages > 2 -%} + 1 + ... + {%- endif -%} + + {# Show nearby pages which number larger than cur_page. #} + {% if total_pages - cur_page < near_pages %} + {% set end_page = cur_page + (total_pages - cur_page) %} + {% else %} + {% set end_page = cur_page + near_pages %} + {% endif %} + + {% for page_no in range((cur_page-near_pages), end_page + 1) %} + {% if page_no != cur_page %} + {{page_no}} + {% else %} + {{ cur_page }} + {% endif %} + {% endfor %} + + {% if total_pages - cur_page > near_pages and total_pages - cur_page != near_pages + 1 %} + ... + {% endif %} + + {% if end_page < total_pages %} + {{total_pages}} + {% endif %} + {% endif %} + {% endif %} + + + {# -- Show 'Next' and 'Last' -- #} + {% if total_pages > 0 %} + + {% if cur_page < total_pages and cur_page != 0 %} + + {% endif %} + + {% if total_pages != 1 %} + {{ _('Last Page') }} + {% endif %} + + {% endif %} +
    +{%- endmacro %} + + +{# Convert event code to event name #} +{% macro show_event_name(event) -%} + {% set event_names = {'all': _('Events'), + 'login': _('Admin login'), + 'user_login': _('User login (self-service)'), + 'create': _('Add account'), + 'delete': _('Delete account'), + 'disable': _('Disable account'), + 'active': _('Activate account'), + 'update': _('Edit account profile'), + 'grant': _('Grant admin'), + 'revoke': _('Revoke admin privilege'), + 'backup': _('Backup'), + 'update_wblist': _('Update whitelists and blacklists'), + 'iredapd': 'iRedAPD', + 'unban': _('Unban IP address'), + 'delete_mailboxes': _('Delete mailboxes')} %} + + {% if event in event_names %} + {{ event_names[event] }} + {% else %} + {{ event |e }} + {% endif %} +{%- endmacro %} + +{% macro display_change_email_address(current_domain, post_url) %} + {# modal window #} + +{%- endmacro %} + +{% macro display_migrate_list_to_ml(mail) %} + {% set (listname, domain) = mail.split('@', 1) %} + + {# modal window #} + +{%- endmacro %} + +{% macro display_migrate_alias_to_ml(mail) %} + {% set (listname, domain) = mail.split('@', 1) %} + + {# modal window #} + +{%- endmacro %} + + + +{# iRedAPD: per-user wblist #} +{% macro display_per_account_wblist(values, htmlInputName, label, rows=20) -%} +
    +
    +

    {{ label |e }} ({{ _('One record per line.') }} {% if values %}{{ _('%d in total.') |format(values |length) }}{% endif %})

    + + {% if values |length == 0 %} + + {% else %} + + {% endif %} +
    +
    +{%- endmacro %} + +{% macro display_per_account_wblist_formats() -%} +
    +
    +
      +
    • {{ _('Whitelist has higher priority than blacklist.') }}
    • +
    • {{ _('Per-user whitelists & blacklists has highest priority, then per-domain setting, then global setting.') }}
    • +
    • {{ _('Mails sent from blacklisted senders will be quarantined by default.') }}
    • +
    + +

    {{ _('Valid record formats') }}

    +
      + {% if session.get('is_global_admin') %} +
    • {{ _('IP Address') }} +
        +
      • {{ _('Single IP Address') }}: 192.168.2.10
      • +
      • {{ _('IP CIDR Network') }}: 192.168.2.0/24, 2620:0:2d0:200::7/128
      • +
      +
    • + {% endif %} + +
    • {{ _('Single user') }}: user@domain.tld
    • +
    • {{ _('User with wildcard') }}: user@*
    • +
    • {{ _('Entire domain') }}: @domain.tld
    • +
    • {{ _('Domain and its sub-domains') }}: @.domain.tld
    • + + {% if session.get('is_global_admin') %} +
    • {{ _('All accounts') }}: @.
    • + {% endif %} +
    +
    +
    {# col1-3 #} +{%- endmacro %} + +{% macro display_per_account_wblist_all(inbound_whitelists=[], + inbound_blacklists=[], + outbound_whitelists=[], + outbound_blacklists=[], + show_inbound_wblist=True, + show_outbound_wblist=True) -%} +
    +
    + {% if show_inbound_wblist %} +

    {{ _('For Inbound Mails') }}

    + {{ display_per_account_wblist(values=inbound_whitelists, + htmlInputName='whitelistSender', + label=_('Whitelisted senders'), + rows=6) }} + + {{ display_per_account_wblist(values=inbound_blacklists, + htmlInputName='blacklistSender', + label=_('Blacklisted senders'), + rows=6) }} + {% endif %} + + {% if show_outbound_wblist %} +

    {{ _('For Outbound Mails') }}

    +
    +
    + {{ display_per_account_wblist(values=outbound_whitelists, + htmlInputName='whitelistRecipient', + label=_('Whitelisted recipients'), + rows=6) }} +
    +
    + {{ display_per_account_wblist(values=outbound_blacklists, + htmlInputName='blacklistRecipient', + label=_('Blacklisted recipients'), + rows=6) }} +
    + {% endif %} +
    + + {{ display_per_account_wblist_formats() }} +
    {# .columns #} +{%- endmacro %} + +{% macro display_allow_nets(allow_nets) -%} +
    +
    +

    {{ _('Restrict to login from specified addresses') }}

    + {{ _('One IP address or CIDR network per line.') }} + +
    + +
    +
    +

    {{ _('Address format') }}

    +
      +
    • {{ _('Single IP Address') }}: 192.168.2.10
    • +
    • {{ _('CIDR formatted range of IP addresses') }}: 192.168.2.0/24
    • +
    +
    +
    +
    +{%- endmacro %} + +{% macro display_disabled_domain_mail_services(disabled_mail_services) -%} + {# service names MUST be SAME as list of variable + + - `AVAILABLE_DOMAIN_DISABLED_MAIL_SERVICES`: libs/sqllib/domain.py + #} + {% set available_services = [ + ('checkbox', 'smtp', _('Sending mails via SMTP')), + ('checkbox', 'smtpsecured', _('Sending mails via SMTP over TLS/SSL')), + ('checkbox', 'pop3', _('Fetching mails via POP3')), + ('checkbox', 'pop3secured', _('Fetching mails via POP3 over TLS/SSL')), + ('checkbox', 'imap', _('Fetching mails via IMAP')), + ('checkbox', 'imapsecured', _('Fetching mails via IMAP over TLS/SSL')), + ('checkbox', 'managesieve', _('Customize mail filter rule')), + ('checkbox', 'managesievesecured', _('Customize mail filter rule over TLS/SSL')), + ('checkbox', 'sogo', _('SOGo Groupware (Calendar, Contacts, Tasks, ActiveSync)')), + ] %} + +
    +
    +
    +

    {{ _('Disabled mail services') }}

    + + {% for srv in available_services %} + {% if not loop.first %} +

     

    + {% endif %} + +
    + + +
    + {% endfor %} +
    +
    {# .col2-3 #} + +
    +
    +

    {{ _('Disabling service will be applied to newly created mail user by default. If you want to update existing mail users, please toggle on checkbox below.') }}

    +

    + + +

    +
    +
    +
    {# .columns #} +{%- endmacro %} + +{% macro display_per_account_alias_addresses(mail, alias_addresses=None) %} + {% if not alias_addresses %} + {% set alias_addresses = [] %} + {% endif %} + +
    +
    +
    +

    {{ _('Alias email addresses') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} +
    + +
    +

    + +
    +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Emails sent to alias addresses will be delivered to %s.') |format('' + mail + '') }}
    • +
    • {{ _('Alias addresses must end with domain name: %s') |format('' + mail.split('@', 1)[-1] + '') }}
    • +
    +
    +
    {# .col1-3 #} +
    {# .columns #} +{% endmacro %} diff --git a/templates/default/macros/iredapd.html b/templates/default/macros/iredapd.html new file mode 100644 index 0000000..6cccfe7 --- /dev/null +++ b/templates/default/macros/iredapd.html @@ -0,0 +1,566 @@ +{% macro display_greylisting_setting(account, gl_setting) -%} + {# + @gl_setting is sql query result of per-account greylisting setting. + #} + + {# Defaults to global setting: account == '@.' #} + {% set account_type = 'global' %} + {% set label = _('Greylisting service') %} + + {# Detect account type #} + {% if account == '@.' %} + {% set account_type = 'global' %} + {% elif account.startswith('@') %} + {% set account_type = 'domain' %} + {% set label = _('Greylisting service for this domain') %} + {% elif '@' in account %} + {% set account_type = 'user' %} + {% set label = _('Greylisting service for this user') %} + {% endif %} + + {# is_greylisted: + @None - Inherit global setting (no greylisting setting found) + @True - Explicitly enabled + @False - Explicitly disabled + #} + {% set is_greylisted = None %} + {% if gl_setting.active == 1 %} + {% set is_greylisted = True %} + {% elif gl_setting.active == 0 %} + {% set is_greylisted = False %} + {% endif %} + +
    +
    +

    {{ label }}

    + + {% if account_type in ['domain', 'user'] %} +
    + {{ _('Inherit global setting') }} +
    +

     

    + {% endif %} + +
    + {{ _('Enable greylisting service') }} +
    + +

     

    +
    + {{ _('Disable greylisting service') }} +
    +
    + + + + {# About greylisting #} + +
    +{% endmacro %} + +{% macro display_greylisting_whitelist_domains(domains) -%} +
    +
    +

    {{ _('Do not apply greylisting on emails sent from domains listed below') }}

    + {{ _('One domain per line.') }} ({{ _('%d in total.') |format(domains |length) }}) + +
    + +
    +
    +
      +
    • {{ _('Server will NOT apply greylisting on IP addresses or networks specified in the SPF and MX DNS records of listed mail domains.') }}
    • +
    +
    +
    +
    +{% endmacro %} + +{% macro display_greylisting_whitelists(account, gl_whitelists) -%} +
    +
    +

    {{ _('Do not apply greylisting on listed senders') }}

    + {{ _('One sender per line.') }}{% if gl_whitelists %} ({{ _('%d in total.') |format(gl_whitelists |length) }}){% endif %} + +
    + +
    +
    +

    {{ _('Sender address format') }}

    +
      +
    • {{ _('IP Address') }} +
        +
      • {{ _('Single IP Address') }}: 192.168.2.10
      • +
      • {{ _('CIDR formatted range of IP addresses') }}: 192.168.2.0/24
      • +
      +
    • + +
    • {{ _('Email address or domain names') }} +
        +
      • {{ _('Single user') }}: user@example.com
      • +
      • {{ _('Entire domain') }}: @example.com
      • +
      • {{ _('All sub-domains') }}: @.example.com
      • +
      +
    • +
    • {{ _('Record comment can be added after a #') }}: 192.168.2.20 # {{ _('Comment') }}
    • +
    +
    +
    +
    +{% endmacro %} + +{% macro display_throttle_setting(account, + setting, + inout_type='inbound', + with_left_border=false) -%} + {# @inout_type: inbound, outbound #} + + {% if not setting %} + {% set has_setting = false %} + {% if account == '@.' %} + {# Global setting #} + {% set setting = {'period': 86400, + 'priority': 0, + 'max_msgs': 0, + 'max_quota': 0, + 'msg_size': 0, + 'max_rcpts': 0} %} + {% else %} + {% set setting = {'period': 86400, + 'priority': 0, + 'max_msgs': -1, + 'max_quota': -1, + 'msg_size': -1, + 'max_rcpts': -1} %} + {% endif %} + {% else %} + {% set has_setting = true %} + {% endif %} + + {% if with_left_border %} +
    + {% else %} +
    + {% endif %} + +
    +
    + + {% if inout_type == 'inbound' -%} + {{ _('Throttle inbound mails') }} + {% else %} + {{ _('Throttle outbound mails') }} + {% endif %} + * +
    +
    + + {% if setting.period in [86400, 3600, 60] %} + {% set is_custom_period = false %} + {% else %} + {% set is_custom_period = true %} + {% endif %} + +
    +

    {{ _('Period of time') }}*

    +
    + {{ _('1 Day') }} +
    +
    + {{ _('1 Hour') }} +
    +
    + {{ _('1 Minute') }} +
    +
    + {{ _('Custom:') }} + {{ _('Seconds') }} +
    +
    + + {# max_msgs #} + {% set is_custom_max_msgs = true %} +
    + {% if inout_type == 'inbound' %} +

    {{ _('Number of max inbound emails') }}

    + {% else %} +

    {{ _('Number of max outbound emails') }}

    + {% endif %} + + {# 1: Unlimited + 2: inherit from throttle setting which has lower priority + 3: define explicit setting + #} + + {% if account != '@.' %} +
    + + {% if account.startswith('@') %} + {{ _('Inherit global throttle setting') }} + {% else %} + {{ _('Inherit per-domain throttle setting') }} + {% endif %} +
    + {% endif %} + +
    + {{ _('Unlimited') }} +
    +
    + {{ _('Custom:') }} + +
    +
    + + {# max_quota #} + {% set is_custom_max_quota = true %} +
    + {% if inout_type == 'inbound' %} +

    {{ _('Cumulative size of all inbound emails') }}

    + {% else %} +

    {{ _('Cumulative size of all outbound emails') }}

    + {% endif %} + + {% if account != '@.' %} +
    + {{ _('Inherit from account which has lower priority') }} +
    + {% endif %} + +
    + {{ _('Unlimited') }} +
    +
    + {{ _('Custom:') }} + Bytes +
    +
    + + {# msg_size #} + {% set is_custom_msg_size = true %} +
    +

    {{ _('Max size of single email') }}

    + + {% if account != '@.' %} +
    + {{ _('Inherit from account which has lower priority') }} +
    + {% endif %} + +
    + {{ _('Unlimited') }} +
    +
    + {{ _('Custom:') }} + Bytes +
    +
    + + {# max_rcpts #} + {% if inout_type == "outbound" %} + {% set is_custom_max_rcpts = true %} +
    +

    {{ _('Max recipients of single email') }}

    + + {% if account != '@.' %} +
    + {{ _('Inherit from account which has lower priority') }} +
    + {% endif %} + +
    + {{ _('Unlimited') }} +
    +
    + {{ _('Custom:') }} + +
    +
    + {% endif %} +
    {# col1-3 #} +{% endmacro %} + +{# iRedAPD: wblist_rdns #} +{% macro display_wblist_rdns(values, html_input_name, label, rows=10) -%} +
    +
    +

    {{ label |e }} ({{ _('One record per line.') }} {% if values %}{{ _('%d in total.') |format(values |length) }}{% endif %}) +

    + + {% if values |length == 0 %} + + {% else %} + + {% endif %} +
    +
    +{%- endmacro %} + +{% macro display_wblist_rdns_formats() -%} +
    +
    +
      +
    • {{ _('Whitelist has higher priority than blacklist.') }}
    • +
    + +

    {{ _('Valid record formats') }}

    +
      +
    • {{ _('Entire domain') }}: domain.tld
    • +
    • {{ _('Domain and its sub-domains') }}: .domain.tld
    • +
    +
    + +
    +

    {{ _("This feature requires iRedAPD plugin 'wblist_rdns', please make sure it's enabled in file /opt/iredapd/settings.py.") }}

    +
    +
    {# col1-3 #} +{%- endmacro %} + +{% macro display_smtp_outbound_sessions(rows) -%} + + + + + + + + + + + + + + {% if rows %} + {% for row in rows %} + {% set sasl_username = row.get('sasl_username', '') |e %} + {% set sender = row.get('sender', '') |e %} + {% set recipient = row.get('recipient', '') |e %} + {% set client_address = row.get('client_address', '') |e %} + {% set encryption_protocol = row.get('encryption_protocol', '') |e %} + + + + + + + + + + {% endfor %} + {% else %} + + {% endif %} + +
    {{ _('Time') }}{{ _('Client Address') }}{{ _('Auth Username') }}{{ _('Envelope Sender') }}{{ _('Recipient') }}{{ _('Encryption Protocol') }}
    {{ row['time'] | utc_to_timezone(timezone=session.get('timezone')) }}{{ client_address }}{{ sasl_username }}{{ sender }}{{ recipient }}{{ encryption_protocol }}
    {{ _('No SMTP authentication activity.') }}
    +{%- endmacro %} + +{% macro display_smtp_sessions(rows, + whitelisted_senderscore_ips=none, + whitelisted_greylisting_ips=none) -%} + {% if whitelisted_senderscore_ips is sameas none %} + {% set whitelisted_senderscore_ips = [] %} + {% endif %} + {% if whitelisted_greylisting_ips is sameas none %} + {% set whitelisted_greylisting_ips = [] %} + {% endif %} + + + + + + + + + + + + + + + + {% if rows %} + {% for row in rows %} + {% set sasl_username = row.get('sasl_username', '') |e %} + {% set sender = row.get('sender', '') |e %} + {% set recipient = row.get('recipient', '') |e %} + {% set client_address = row.get('client_address', '') |e %} + {% set action = row.get('action', '') |e %} + {% set reason = row.get('reason', '') | e %} + + {% set _is_senderscore = false %} + {% set _is_greylisting = false %} + {% set _is_whitelisted = false %} + {% set _onclick_func = none %} + + {% if action == 'REJECT' and reason.startswith('Server IP address has bad reputation') %} + {% set _is_senderscore = true %} + {% set _onclick_func = 'whitelist_ip_for_senderscore' %} + + {% if client_address in whitelisted_senderscore_ips %} + {% set _is_whitelisted = true %} + {% endif %} + {%- elif action == '451' and reason == '4.7.1 Intentional policy rejection, please try again later' -%} + {% set _is_greylisting = true %} + {% set _onclick_func = 'whitelist_ip_for_greylisting' %} + + {% if client_address in whitelisted_greylisting_ips %} + {% set _is_whitelisted = true %} + {% endif %} + {% endif %} + + + + + + + + + + + {% endfor %} + {% else %} + + {% endif %} + +
    {{ _('Time') }}{{ _('Client Address') }}{{ _('Auth Username') }}{{ _('Envelope Sender') }}{{ _('Recipient') }}{{ _('SMTP Action') }}{{ _('Rejection Reason') }}
    {{ row['time'] | utc_to_timezone(timezone=session.get('timezone')) }} + {{ client_address }} + {% if session.get('is_global_admin') %} + {% if _is_whitelisted %} + {{ _('Whitelisted') }} + {% elif _is_senderscore or _is_greylisting %} + {# Display a button to whitelist this IP address. #} + {{ _('Whitelist') }} + {% endif %} + {% endif %} + {{ sasl_username }}{{ sender }}{{ recipient }} + {%- if action == 'DUNNO' -%} + {{ _('Dunno') }} + {%- elif action == 'OK' -%} + {{ _('Whitelisted') }} + {%- else %} + {% if _is_greylisting %} + {{ _('Greylisted') }} + {%- else -%} + {{ action }} + {%- endif -%} + {%- endif -%} + {% if action not in ['DUNNO', 'OK', '451'] %}{{ reason }}{% endif %}
    {{ _('No matched SMTP sessions.') }}
    +{%- endmacro %} + +{% macro display_idtabs_of_smtp_sessions(activity) -%} +
  • {{ _('All') }}
  • +
  • {{ _('Rejected') }}
  • +
  • {{ _('Outbound') }}
  • +{%- endmacro %} diff --git a/templates/default/macros/mlmmj.html b/templates/default/macros/mlmmj.html new file mode 100644 index 0000000..cc4839a --- /dev/null +++ b/templates/default/macros/mlmmj.html @@ -0,0 +1,410 @@ +{% from "macros/form_inputs.html" import + input_text, + input_checkbox, + input_textarea, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_filter_by_first_char, + display_list_access_policies + with context + %} + +{% macro display_maillist_basic_profile(profile=None, access_policy=None, mail=None) -%} + {% if not profile %} + {% set profile = {} %} + {% endif %} + + {{ input_text(label=_('Prefix text to mail subject'), + input_name='subject_prefix', + value=profile.get('subject_prefix', '')) }} + + {% set max_mail_size_in_bytes = profile.get('max_message_size', '0') | int %} + {% if max_mail_size_in_bytes == 0 %} + {% set max_mail_size_in_form = 0 %} + {% set max_mail_size_unit = 'MB' %} + {% elif (max_mail_size_in_bytes % 1024) == 0 and max_mail_size_in_bytes >= (1024*1024) %} + {# MB #} + {% set max_mail_size_in_form = (max_mail_size_in_bytes / (1024*1024)) | int %} + {% set max_mail_size_unit = 'MB' %} + {% else %} + {# KB #} + {% set max_mail_size_in_form = (max_mail_size_in_bytes / 1024) |int %} + {% set max_mail_size_unit = 'KB' %} + {% endif %} + +
    +

    {{ _('Max message size') }}

    + + + MB + KB +
    + + {{ input_textarea(label=_('Footer text (plain text format)'), + input_name='footer_text', + value=profile.get('footer_text', ''), + rows=3, + cols='60%') }} + + {{ input_textarea(label=_('Footer text (HTML format)'), + input_name='footer_html', + value=profile.get('footer_html', ''), + rows=3, + cols='60%') }} + +
    + + {{ display_list_access_policies(policy=access_policy, enable_members_and_moderators_only=false) }} +
    + + {{ input_checkbox(label=_('Archive'), + input_name='disable_archive', + checked=profile.get('disable_archive'), + comment=_('Do not archive received emails'), + comment_as_tooltip=false, + add_hidden_input=true) }} + +
    + + {{ input_checkbox(label=_('Mail posting'), + input_name='disable_send_copy_to_sender', + checked=profile.get('disable_send_copy_to_sender'), + comment=_('Do not send a copy to sender'), + comment_as_tooltip=false, + add_hidden_input=true) }} + +
    + + {{ input_checkbox(label=_('Subscription control'), + input_name='close_list', + checked=profile.get('close_list'), + comment=_('Disable subscription and unsubscription via email (existing subscribers are still able to send to list)'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='disable_subscription', + checked=profile.get('disable_subscription'), + comment=_('Disable subscription but allow unsubscription via email'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='disable_subscription_confirm', + checked=profile.get('disable_subscription_confirm'), + comment=_('Disable subscription confirm'), + comment_as_tooltip=false, + add_hidden_input=true) }} + +
    + + {{ input_checkbox(label=_('Access control'), + input_name='moderated', + checked=profile.get('moderated'), + comment=_('Moderate all posts (Moderators are required)'), + comment_as_tooltip=false, + add_hidden_input=true) }} + +
    + + {{ input_checkbox(label=_('Notifications'), + input_name='disable_notify_when_subscriber_only', + checked=profile.get('disable_notify_when_subscriber_only'), + comment=_('Do not notify sender when posting to a subscriber-only mailing list was denied'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='disable_notify_when_moderator_only', + checked=profile.get('disable_notify_when_moderator_only'), + comment=_('Do not notify sender when posting to a moderator-only mailing list was denied'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='disable_notify_subscription_moderated', + checked=profile.get('disable_notify_subscription_moderated'), + comment=_('Do not notify subscription requestor when subscription is under moderated'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='disable_notify_when_exceeding_max_mail_size', + checked=profile.get('disable_notify_when_exceeding_max_mail_size'), + comment=_('Do not notify sender when posting was denied due to exceed max message size'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='notify_sender_when_moderated', + checked=profile.get('notify_sender_when_moderated'), + comment=_('Notify sender if email is under moderated'), + comment_as_tooltip=false, + add_hidden_input=true) }} + + {{ input_checkbox(label='', + input_name='notify_owner_when_sub_unsub', + checked=profile.get('notify_owner_when_sub_unsub'), + comment=_('Notify owner(s) when someone subscribe to or unsubscribe from the mailing list'), + comment_as_tooltip=false, + add_hidden_input=true) }} + +{%- endmacro %} + + +{% macro display_maillist_owners(mail, addresses=None) %} + {% if not addresses %} + {% set addresses = [] %} + {% endif %} + + {% set (listname, domain) = mail.split('@', 1) %} + +
    +
    +
    +

    {{ _('Owners') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Email addresses of the mailing list owners which need to be contacted via email %s, either by the system or by end users.') | format(listname + '+owner@' + domain) }}
    • +
    +
    +
    +
    {# .columns #} +{% endmacro %} + + +{% macro display_maillist_moderators(mail, addresses=None) %} + {% if not addresses %} + {% set addresses = [] %} + {% endif %} + +
    +
    +
    +

    {{ _('Moderators') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Email addresses of the mailing list moderators which need to be contacted when there is some email under moderated. If empty, mailing list owners will be used instead.') }}
    • +
    +
    +
    +
    {# .columns #} +{% endmacro %} + +{% macro display_maillist_subscription_moderators(mail, profile, addresses=None) %} + {% if not addresses %} + {% set addresses = [] %} + {% endif %} + +
    +
    + {{ input_checkbox(label=_('Moderate subscriptions'), + input_name='moderate_subscription', + checked=profile.get('moderate_subscription'), + add_hidden_input=true) }} + +
    +

    {{ _('Subscription Moderators') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Email addresses of the mailing list moderators which need to be contacted when there is someone subscribing to the list and under moderated. If empty, mailing list moderators will be used instead.') }}
    • +
    +
    +
    +
    {# .columns #} +{% endmacro %} + +{% macro display_modal_add_subscribers(form_post_url) %} + +{% endmacro %} + +{% macro display_maillist_subscribers(mail, subscribers=None, account_is_enabled=true) -%} +
    + + {{ _('Filter:') }} + + {% if account_is_enabled %} + + {{ _('Add new members') }} + {% else %} + {{ _('To add new members, please enable mailing list account first.') }} + {% endif %} +
    + + + + + + + + + + + + + {% if subscribers %} + {% for i in subscribers |sort(attribute='mail') %} + {% set _mail = i.mail |e %} + {% set _subscription = i.subscription | e %} + {% set _domain = _mail.split('@', 1)[-1] %} + + + + + + + + {% endfor %} + {% else %} + + + + + {% endif %} + +
    {{ _('Email') }}{{ _('Domain') }}{{ _('Mail Delivery') }}
    {{ _mail }}{{ _domain }} + {%- if _subscription == 'normal' -%} + {{ _('All emails') }} + {%- elif _subscription == 'digest' -%} + {{ _('Digest') }} + {%- elif _subscription == 'nomail' -%} + {{ _('No email') }} + {%- else %} + {{ _subscription }} + {%- endif -%} +
    {{ _('No members.') }}
    + + {% if subscribers %} + + {% endif %} +{% endmacro %} + +{% macro display_modal_newsletter_html_code(mlid) %} + +{% endmacro %} + +{% macro display_maillist_newsletter_profile(is_newsletter=False, description=None) -%} + + {% if not description %} + {% set description = '' %} + {% endif %} + +
    +
    + {{ input_checkbox(label=_('Enable newsletter-style mailing list'), + input_name='is_newsletter', + comment=_('Enable subscription and unsubscription from website'), + checked=is_newsletter) }} + + {{ input_textarea(label=_('Text to introduce this newsletter on subscription page'), + input_name='description', + value=description) }} + +
    + +
    +{%- endmacro %} diff --git a/templates/default/macros/msg_handlers.html b/templates/default/macros/msg_handlers.html new file mode 100644 index 0000000..4a39b37 --- /dev/null +++ b/templates/default/macros/msg_handlers.html @@ -0,0 +1,475 @@ +{% macro success_info(msg, removable=true, trusted=false) -%} +
    + {% if removable is not sameas false %} + Close + {% endif %} + +

    + {% if trusted %} + {{ msg }} + {% else %} + {{ msg |e }} + {% endif %} +

    +
    +{%- endmacro %} + +{% macro error_info(msg, removable=false, trusted=false) -%} +
    + {% if removable is not sameas false %} + Close + {% endif %} + +

    {{ _('Error:') }} + {% if trusted %} + {{ msg }} + {% else %} + {{ msg |e }} + {% endif %} +

    +
    +{%- endmacro %} + +{% macro warning_info(msg, removable=false, trusted=false) -%} +
    + {% if removable is not sameas false %} + Close + {% endif %} + +

    + {% if trusted %} + {{ msg }} + {% else %} + {{ msg |e }} + {% endif %} +

    +
    +{%- endmacro %} + +{% macro general_info(msg, removable=true, trusted=false) -%} +
    + {% if removable is not sameas false %} + Close + {% endif %} + +

    + {% if trusted %} + {{ msg }} + {% else %} + {{ msg |e }} + {% endif %} +

    +
    +{%- endmacro %} + +{% macro login_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'LOGIN_REQUIRED': error_info(_('Login required')), + 'INVALID_CREDENTIALS': error_info(_('Username or password is incorrect.')), + 'INVALID_USERNAME': error_info(_('Username must be an valid email address.')), + 'EMPTY_PASSWORD': error_info(_('Empty password is not allowed.')), + 'SESSION_EXPIRED': error_info(_('Session expired, please re-login.')), + 'NOT_ALLOWED_IP': error_info(_('Login from your IP address is not allowed.')), + 'INVALID_PRODUCT_ID': error_info(_('Your license is invalid. Please contact support@iredmail.org to fix it.')), + } + %} + + {% if msg == 'SERVER_DOWN' %} + {{ error_info(_('Server is down. Please contact webmaster to solve it.' % webmaster ), trusted=true) }} + {% elif msg is sameas false %} + {{ error_info( ('Authentication failed.') ) }} + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info( msg ) }} + {% endif %} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro creation_limit_msg_handler(msg=none) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'EXCEED_LIMIT_DOMAIN': error_info(_('Already reaches account limit (mail domains).')), + 'EXCEED_LIMIT_QUOTA': error_info(_('Already reaches account limit (mailbox quota).')), + 'EXCEED_LIMIT_USERS': error_info(_('Already reaches account limit (mail users).')), + 'EXCEED_LIMIT_ALIASES': error_info(_('Already reaches account limit (mail aliases).')), + 'EXCEED_LIMIT_LISTS': error_info(_('Already reaches account limit (mailing lists).')), + } + %} + + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro domain_msg_handler(msg=none) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'UPDATED': success_info(_('Profile has been updated.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'DELETED': success_info(_('Selected domains have been deleted.')), + 'DISABLED': success_info(_('Selected domains were disabled.')), + 'ENABLED': success_info(_('Selected domains were enabled.')), + 'INVALID_DOMAIN_NAME': error_info(_('Invalid domain name.')), + 'INVALID_MAIL': error_info(_('Invalid mail address.')), + 'EMPTY_DOMAIN': error_info(_('Domain name is empty.')), + 'EXCEEDED_LDAP_SERVER_SIZELIMIT': error_info(_('Server-side size limit exceeded. Please increase "sizelimit" in your LDAP server.')), + 'ALREADY_EXISTS': error_info(_('Domain already exists. Please check both primary or alias domains.')), + 'PERMISSION_DENIED': error_info(_('Permission denied.')), + 'DOMAIN_NAME_MISMATCH': error_info(_('Submited domain name is incorrect.')), + 'NO_SUCH_ACCOUNT': error_info(_('Account does not exist.')), + 'NO_DOMAIN_SELECTED': error_info(_('Please select at least one domain.')), + 'NO_DOMAIN_AVAILABLE': error_info(_('No domain under control.')), + 'EXCEED_LIMIT_DOMAIN': error_info(_('Already reaches account limit (mail domains).')), + 'EXCEED_LIMIT_QUOTA': error_info(_('Already reaches account limit (mailbox quota).')), + 'EXCEED_LIMIT_USERS': error_info(_('Already reaches account limit (mail users).')), + 'EXCEED_LIMIT_ALIASES': error_info(_('Already reaches account limit (mail aliases).')), + 'EXCEED_LIMIT_LISTS': error_info(_('Already reaches account limit (mailing lists).')), + } + %} + + {% if msg == 'CREATED' %} +
    +

    + {{ _('Domain created.') }} {{ _('Add one more?') }} {{ _('Or create other mail accounts:') }} {{ _('User') }}, {{ _('Mailing List') }}. +

    +
    + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} + {% endif %} + +{% endif %} +{%- endmacro %} + +{% macro user_msg_handler(msg) -%} +{% if msg %} + {% set handlers = { + 'UPDATED': success_info(_('Profile has been updated.')), + 'UPDATED_FAILED': error_info( _('Profile updated failed.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'NO_DOMAIN_AVAILABLE': general_info( _('No domain under control.') ), + 'MISSING_DOMAIN_OR_USERNAME': error_info( _('Domain name or username is missed.') ), + 'INVALID_MAIL': error_info(_('Invalid mail address.')), + 'INVALID_ACCOUNT': error_info(_('Invalid account.')), + 'EXCEEDED_DOMAIN_QUOTA_SIZE': error_info(_('Domain quota size exceeded. Please contact your administrator or service provider to increase it.')), + 'EXCEEDED_DOMAIN_ACCOUNT_LIMIT': error_info(_('Exceeded domain account limit. Please contact your administrator or service provider to increase it.')), + 'DELETED': success_info( _('Selected accounts were deleted.') ), + 'DISABLED': success_info( _('Selected accounts were disabled.') ), + 'ENABLED': success_info( _('Selected accounts were enabled.') ), + 'MARKASADMIN': success_info( _('Selected accounts were marked as domain admin.') ), + 'UNMARKASADMIN': success_info( _('Selected accounts were unmarked as domain admin.') ), + 'MARKASGLOBALADMIN': success_info( _('Selected accounts were marked as global admin.') ), + 'UNMARKASGLOBALADMIN': success_info( _('Selected accounts were unmarked as global admin.') ), + 'INCORRECT_OLDPW': error_info( _('Current password is incorrect.') ), + 'PW_MISMATCH': error_info( _('New passwords are not match.') ), + 'PW_NON_ASCII': error_info( _('Please do not use non-ascii character in password.') ), + 'PW_EMPTY': error_info( _('Password is empty.') ), + 'PW_SHORTER_THAN_MIN_LENGTH': error_info( _('Password is too short.') ), + 'PW_GREATER_THAN_MAX_LENGTH': error_info( _('Password is too long.') ), + 'PW_NO_LETTER': error_info( _('No letter in password.') ), + 'PW_NO_UPPERCASE': error_info( _('No uppercase letter in password.') ), + 'PW_NO_DIGIT_NUMBER': error_info( _('No digit number in password.') ), + 'PW_NO_SPECIAL_CHAR': error_info( _('No special character in password.') ), + 'ALREADY_EXISTS': error_info(_('Account already exists, please choose another one.')), + 'NO_DOMAIN': error_info(_('No mail domain available.')), + 'NO_ACCOUNT_SELECTED': error_info(_('Please select at least one account.')), + 'NOT_ALLOWED': error_info(_('Not allowed to create mail user under this domain.')), + 'PERMISSION_DENIED': error_info(_("Permission denied.")), + 'PERMISSION_DENIED_UPDATE_GLOBAL_ADMIN_PROFILE': error_info(_("You are not allowed to update global domain admin's profile.")), + 'WBLIST_UPDATED': success_info( _('Records were successfully updated.')), + 'EMAIL_CHANGED': success_info( _('Email address was changed.')), + 'NO_SUCH_ACCOUNT': error_info(_('Account does not exist.')), + } + %} + + {% if msg == 'CREATED' %} +
    +

    + {{ _('User created.') }} {{ _('Add one more?') }} +

    +
    + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} + {% endif %} +{% endif %} + +{%- endmacro %} + +{% macro admin_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'UPDATED': success_info(_('Profile has been updated.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'PERMISSION_DENIED': error_info(_("Permission denied.")), + 'DELETED': success_info(_('Selected accounts were deleted.')), + 'DISABLED': success_info(_('Selected accounts were disabled.')), + 'ENABLED': success_info(_('Selected accounts were enabled.')), + 'NO_ACCOUNT_SELECTED': error_info(_('No account selected.')), + 'INCORRECT_OLDPW': error_info(_('Current password is incorrect.')), + 'INVALID_CREDENTIALS': error_info(_('Current password is incorrect.')), + 'PW_MISMATCH': error_info(_('New passwords are not match.')), + 'PW_NON_ASCII': error_info( _('Please do not use non-ascii character in password.') ), + 'PW_EMPTY': error_info(_('Password is empty.')), + 'PW_NO_LETTER': error_info( _('No letter in password.') ), + 'PW_NO_UPPERCASE': error_info( _('No uppercase letter in password.') ), + 'PW_NO_DIGIT_NUMBER': error_info( _('No digit number in password.') ), + 'PW_NO_SPECIAL_CHAR': error_info( _('No special character in password.') ), + 'INVALID_MAIL': error_info(_('Invalid mail address.')), + 'ALREADY_EXISTS': error_info(_('Account already exists, please choose another one.')), + 'NO_SUCH_ACCOUNT': error_info(_('Account does not exist.')), + 'CAN_NOT_BE_LOCAL_DOMAIN': error_info(_('Standalone admin account cannot be an user of local domain.')), + } + %} + + {% if msg == 'CREATED' %} +
    +

    + {{ _('Admin created.') }} {{ _('Add one more?') }} +

    +
    + {% elif msg == 'PW_SHORTER_THAN_MIN_LENGTH' %} + {{ error_info( _('New password must contain at least %s characters.') |format(min_passwd_length) ) }} + {% elif msg == 'PW_GREATER_THAN_MAX_LENGTH' %} + {{ error_info( _('New password must NOT contain more than %s characters.') |format(max_passwd_length) ) }} + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro maillist_msg_handler(msg) -%} +{% if msg %} + {% set handlers = { + 'ALREADY_EXISTS': error_info(_('Account already exists, please choose another one.')), + 'INVALID_MAIL': error_info(_('Invalid mail address.')), + 'NO_ACCOUNT_SELECTED': error_info(_('No account selected.')), + 'UPDATED': success_info(_('Profile has been updated.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'UPDATED_FAILED': error_info(_('Profile updated failed.')), + 'MEMBER_ASSIGNED': success_info(_('Member assigned success.')), + 'MEMBER_REMOVED': success_info(_('Member removed success.')), + 'MODERATOR_ASSIGNED_SUCCESS': success_info(_('Moderators assigned success.')), + 'MODERATOR_REMOVED_SUCCESS': success_info(_('Moderators removed success.')), + 'DELETED': success_info(_('Selected accounts were deleted.')), + 'DISABLED': success_info(_('Selected accounts were disabled.')), + 'ENABLED': success_info(_('Selected accounts were enabled.')), + 'NO_DOMAIN_AVAILABLE': general_info(_('No domain under control.')), + 'NO_MODERATOR_SELECTED': error_info(_('No moderator selected.')), + 'NOT_ALLOWED': error_info(_('Not allowed to create mailing list under this domain.')), + 'NO_SUCH_ACCOUNT': error_info(_('Account does not exist.')), + 'EMAIL_CHANGED': success_info( _('Email address was changed.')), + 'MEMBERS_ADDED': success_info( _('Members has been added to mailing list.')), + 'CONFIRM_MAIL_SENT': success_info( _('Confirm email has been sent to new members. Members will appear below after they confirmed the subscription.')), + 'MIGRATED': success_info( _('Successfully migrated.')), + 'PERMISSION_DENIED': error_info(_('Permission denied.')), + } + %} + + {% if msg == 'CREATED' %} +
    +

    + {{ _('Mailing list created.') }} {{ _('Add one more?') }} +

    +
    + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro alias_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'ALREADY_EXISTS': error_info(_('Account already exists, please choose another one.')), + 'UPDATED': success_info(_('Profile has been updated.')), + 'INVALID_MAIL': error_info(_('Invalid mail address.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'NO_DOMAIN_AVAILABLE': general_info(_('No domain under control.')), + 'DELETED': success_info(_('Selected accounts were deleted.')), + 'DISABLED': success_info(_('Selected accounts were disabled.')), + 'ENABLED': success_info(_('Selected accounts were enabled.')), + 'MEMBER_ASSIGNED': success_info(_('Member assigned success.')), + 'MEMBER_REMOVED': success_info(_('Member removed success.')), + 'UPDATED_FAILED': error_info(_('Profile updated failed.')), + 'EMPTY_LISTNAME': error_info(_('Empty address is not allowed.')), + 'NOT_ALLOWED': error_info(_('Not allowed to create mail alias under this domain.')), + 'NO_SUCH_ACCOUNT': error_info(_('Account does not exist.')), + 'EMAIL_CHANGED': success_info( _('Email address was changed.')), + } + %} + + {% if msg == 'CREATED' %} +
    +

    + {{ _('Mail alias created.') }} {{ _('Add one more?') }} +

    +
    + {% else %} + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro log_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% if msg == 'DELETED' %} + {{ success_info( _('Selected log records were deleted.') ) }} + {% elif msg == 'INVALID_PRODUCT_ID' %} + {{ error_info( _('Invalid product id.') ) }} + {% else %} + {{ error_info( msg ) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro amavisd_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% set handlers = { + 'WBLIST_CREATED': success_info( _('Records were successfully added.')), + 'WBLIST_UPDATED': success_info( _('Records were successfully updated.')), + 'DELETED': success_info(_('Selected log records were deleted.')), + 'RELEASED': success_info(_('Mails were released.')), + 'RELEASED_WL_SENDER': success_info(_('Mails were released, and sender(s) were whitelisted.')), + 'RELEASED_WL_SENDER_DOMAIN': success_info(_('Mails were released, and sender domain(s) were whitelisted.')), + 'RELEASED_WL_SENDER_SUBDOMAIN': success_info(_('Mails were released, sender domain(s) and sub-domains were whitelisted.')), + 'DELETED': success_info(_('Mails were deleted.')), + 'DELETED_WL_SENDER': success_info(_('Mails were deleted, and sender(s) were whitelisted.')), + 'DELETED_WL_SENDER_DOMAIN': success_info(_('Mails were deleted, and sender domain(s) were whitelisted.')), + 'DELETED_WL_SENDER_SUBDOMAIN': success_info(_('Mails were deleted, sender domain(s) and sub-domain(s) were whitelisted.')), + 'DELETED_BL_SENDER': success_info(_('Mails were deleted, and sender(s) were blacklisted.')), + 'DELETED_BL_SENDER_DOMAIN': success_info(_('Mails were deleted, and sender domain(s) were blacklisted.')), + 'DELETED_BL_SENDER_SUBDOMAIN': success_info(_('Mails were deleted, sender domain(s) and sub-domain(s) were blacklisted.')), + 'DELETED_WL_RCPT': success_info(_('Mails were deleted, and recipient(s) were whitelisted.')), + 'DELETED_WL_RCPT_DOMAIN': success_info(_('Mails were deleted, and recipient domain(s) were whitelisted.')), + 'DELETED_WL_RCPT_SUBDOMAIN': success_info(_('Mails were deleted, recipient domain(s) and sub-domain(s) were whitelisted.')), + 'DELETED_BL_RCPT': success_info(_('Mails were deleted, and recipient(s) were blacklisted.')), + 'DELETED_BL_RCPT_DOMAIN': success_info(_('Mails were deleted, and recipient domain(s) were blacklisted.')), + 'DELETED_BL_RCPT_SUBDOMAIN': success_info(_('Mails were deleted, recipient domain(s) and sub-domain(s) were blacklisted.')), + 'INVALID_ACCOUNT': error_info(_('Invalid domain name or mail address.')), + 'INVALID_ACTION': error_info(_('Invalid action.')), + 'INVALID_MAILID': error_info(_('Invalid request data.')), + 'PERMISSION_DENIED': error_info(_('Permission denied.')), + } + %} + + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{# Search accounts #} +{% macro search_msg_handler(msg) -%} +{% if msg is defined and msg is not sameas none and msg|string != '' %} + {% if msg == 'SUCCESS' %} + {{ success_info( _('Operation completed.') ) }} + {% elif msg == 'EMPTY_STRING' %} + {{ error_info( _('Search keyword could not be empty.') ) }} + {% elif msg == 'INVALID_MAIL' %} + {{ error_info( _('Invalid mail address.') ) }} + {% elif msg == 'INVALID_ACTION' %} + {{ error_info(_('Invalid action.')) }} + {% else %} + {{ error_info( msg ) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro throttle_msg_handler(msg) -%} +{% if msg %} + {% set handlers = { + 'CREATED': success_info( _('Records were successfully added.') ), + 'UPDATED': success_info(_('Profile has been updated.')), + 'DELETED': success_info( _('Selected records were deleted.') ), + 'INVALID_ACTION': error_info(_('Invalid action.')), + } %} + + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ error_info(msg) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro greylist_msg_handler(msg) -%} +{% if msg %} + {% if msg == 'GL_UPDATED' %} + {{ success_info(_('Greylisting settings have been updated.')) }} + {% else %} + {{ error_info( msg ) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro wblist_msg_handler(msg) -%} +{% if msg %} + {% if msg == 'UPDATED' %} + {{ success_info(_('Profile has been updated.')) }} + {% else %} + {{ error_info( msg ) }} + {% endif %} +{% endif %} +{%- endmacro %} + +{% macro domain_ownership_msg_handler(msg) -%} +{% if msg %} + {% if msg == 'PERMISSION_DENIED' %} + {{ error_info(_('Permission denied.')) }} + {% else %} + {{ error_info( msg ) }} + {% endif %} +{% endif %} +{%- endmacro %} + + +{# NOTE: newsletter error page use different CSS framework, do not use macros + like `success_info()`, `error_info()` defined in this Jinja2 template + file. +#} +{% macro newsletter_error_msg_handler(msg) -%} +{% if msg %} + {% set handlers = { + 'INVALID_NEWSLETTER': _('Oops, the newsletter you want to subscribe does not exist.'), + 'INVALID_ACTION': _('Oops, invalid action.'), + 'TOKEN_INVALID': _('Oops, confirm link is invalid.'), + 'TOKEN_EXPIRED': _('Oops, confirm link expired. Please re-subscribe.'), + 'INVALID_SUBSCRIBER_EMAIL_ADDRESS': _('Error, you entered an invalid email address.'), + 'INTERNAL_SERVER_ERROR': _('Internal server error, please contact server admin to fix it.'), + } %} + + {% if msg in handlers %} + {{ handlers[msg] }} + {% else %} + {{ msg | e }} + {% endif %} +{% endif %} +{%- endmacro %} diff --git a/templates/default/macros/sql.html b/templates/default/macros/sql.html new file mode 100644 index 0000000..200f834 --- /dev/null +++ b/templates/default/macros/sql.html @@ -0,0 +1,210 @@ +{% from "macros/general.html" import + set_account_status_img + with context + %} + +{% macro display_all_domains(managedDomains=None, allDomains=None) -%} + {% if not managedDomains %} + {% set managedDomains = [] %} + {% endif %} + + {% if not allDomains %} + {% set allDomains = [] %} + {% endif %} + +
    +
    +
    +

    {{ _('Managed Domains') }}

    +
    +
    + {{ _('%d of %d in total.') | format(managedDomains |length, allDomains | length) }} + {{ _('Filter:') }} +
    +
    + + + {# thead will be hidden. #} + + + + + + + + {% for r in allDomains %} + {% set domain = r.domain |e %} + + + + + {% endfor %} + +
    + + {{ domain }} + {% if r.description %}({{ r.description |cut_string |e }}){% endif %} +
    +
    +
    +
    {#-- .col2-3 --#} + + {% if session.get('is_global_admin') %} +
    + +
    + {% endif %} +
    {#-- .columns --#} +{%- endmacro %} + + +{% macro display_enabled_user_services(profile, greylisted=False) -%} + {% set available_services = [ + ('checkbox', 'enabledeliver', _('Accepting mails sent to this account on mail server')), + ('checkbox', 'enablesmtp', _('Sending mails via SMTP')), + ('checkbox', 'enablesmtpsecured', _('Sending mails via SMTP over TLS/SSL')), + ('checkbox', 'enablepop3', _('Fetching mails via POP3')), + ('checkbox', 'enablepop3secured', _('Fetching mails via POP3 over TLS/SSL')), + ('checkbox', 'enableimap', _('Fetching mails via IMAP')), + ('checkbox', 'enableimapsecured', _('Fetching mails via IMAP over TLS/SSL')), + ('checkbox', 'enablemanagesieve', _('Customize mail filter rule')), + ('checkbox', 'enablemanagesievesecured', _('Customize mail filter rule over TLS/SSL')), + ('checkbox', 'enablesogo', _('SOGo Groupware (Webmail, Calendar, ActiveSync)')), + ('checkbox', 'enablesogowebmail', _('SOGo Webmail')), + ('checkbox', 'enablesogocalendar', _('SOGo Calendar')), + ('checkbox', 'enablesogoactivesync', _('SOGo ActiveSync')), + ] %} + +
    +
    + +
    +

    {{ _('Enabled Services') }}

    + + {% for srv in available_services %} + {% if not loop.first %} +

     

    + {% endif %} + + {% set name = srv[1] %} + +
    + {% if name in ["enablesogowebmail", "enablesogocalendar", "enablesogoactivesync"] %} +     |- + {% endif %} + + +
    + {% endfor %} +
    + +
    {# col2-3 #} +
    {# columns #} +{%- endmacro %} + + +{% macro display_enabled_domain_services(enabled_services) -%} + {% set available_services = [ + ('checkbox', 'self-service', _('Self-service')), + ] %} + +
    +
    +
    +

    {{ _('Enabled Services') }}

    + + {% for srv in available_services %} + {% if not loop.first %} +

     

    + {% endif %} + +
    + + +
    + {% endfor %} +
    +
    {# .col2-3 #} +
    {# .columns #} +{%- endmacro %} + +{% macro display_mls(maillists, profile_base_url, domain=None) %} + + + + + + + + + + + + + {% if maillists|length > 0 %} + {% for r in maillists %} + {% set address = r.address |e %} + {% set name = r.name |e %} + {% set access_policy = r.accesspolicy |e %} + {% set account_status = r.active %} + + + + + + + + {% endfor %} + {% else %} + + + + + {% endif %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('Mail Deliver Restriction') }}
    + + + {{ set_account_status_img(account_status) }} + {% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(address) }}{{ display_list_access_policy_name(policy=access_policy) }}
    {{ _('No mailing list available.') }} + {% if (not session['account_is_mail_user']) and domain %} + {% if not first_char %} + {{ _('Add one') }}? + {% endif %} + {% endif %} +
    +{% endmacro %} diff --git a/templates/default/mlmmj/errors.html b/templates/default/mlmmj/errors.html new file mode 100644 index 0000000..cdbdaa6 --- /dev/null +++ b/templates/default/mlmmj/errors.html @@ -0,0 +1,16 @@ +{% extends "mlmmj/layout.html" %} +{% from "macros/msg_handlers.html" import newsletter_error_msg_handler with context %} + +{% block title %}{{ _('Error') }}{% endblock %} + +{% block main %} + +
    +
    +
    + + {{ newsletter_error_msg_handler(msg) }} +
    +
    +
    +{% endblock main %} diff --git a/templates/default/mlmmj/layout.html b/templates/default/mlmmj/layout.html new file mode 100644 index 0000000..cda3b76 --- /dev/null +++ b/templates/default/mlmmj/layout.html @@ -0,0 +1,21 @@ + + + + + + + {% block title %}{%endblock%} + + + + + + + + + + {% block main %}{% endblock %} + + diff --git a/templates/default/mlmmj/subunsub.html b/templates/default/mlmmj/subunsub.html new file mode 100644 index 0000000..457df13 --- /dev/null +++ b/templates/default/mlmmj/subunsub.html @@ -0,0 +1,80 @@ +{% extends "mlmmj/layout.html" %} + +{% block title %} + {%- if action == 'subscribe' -%} + {{ _('Subscribe') }} + {%- else -%} + {{ _('Unsubscribe') }} + {%- endif -%} +{% endblock title %} + +{% block main %} + +
    +
    +
    +
    + +
    + + {# Display custom name or default text. #} + {% if name %} +

    {{ name |e }}

    + {% else %} +

    + {%- if action == 'subscribe' -%} + {{ _('Subscribe to newsletter') }} + {%- else -%} + {{ _('Unsubscribe from newsletter') }} + {%- endif -%} +

    + {% endif %} + + {# Display description of the newsletter. #} + {% if description %} +

    {{ description }}

    + {% endif %} + + {% if msg == 'SUBSCRIBED' %} +
    {{ _('Thank you for subscribing.') }}
    + {% elif msg == 'UNSUBSCRIBED' %} +
    {{ _('Successfully unsubscribed.') }}
    + {% elif msg in ['WAIT_FOR_SUBCONFIRM', 'WAIT_FOR_UNSUBCONFIRM'] %} +
    + + {{ _('Almost finished.') }} +
    +
    + + {%- if action == 'subscribe' -%} + {{ _('We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.') }} + {%- else -%} + {{ _('We need to confirm your email address. To complete the unsubscription process, please click the link in the email we just sent you.') }} + {%- endif -%} + +
    + {% else %} +
    + + +
    + +
    + {{ _('Or') }}   + {%- if action == 'subscribe' -%} + {{ _('Unsubscribe') }} + {%- else -%} + {{ _('Subscribe') }} + {%- endif -%} +
    + {% endif %} +
    +
    +
    +{% endblock main %} diff --git a/templates/default/panel/domain_ownership.html b/templates/default/panel/domain_ownership.html new file mode 100644 index 0000000..1876c98 --- /dev/null +++ b/templates/default/panel/domain_ownership.html @@ -0,0 +1,113 @@ +{% extends "layout.html" %} + +{% from "macros/msg_handlers.html" import domain_ownership_msg_handler with context %} + +{% block title %}{{ _('Domain ownership verification') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} +{% block main %} + +{# Show system message #} +{{ domain_ownership_msg_handler(msg) }} + +
    +
    +
    +

    {{ _('Domain ownership verification') }}

    +
    + +
    +
    +

    {{ _('Please verify mail domains listed below, to ensure that it is an valid domain and you have the required privileges in the domain to manage the email services. Mail services are disabled for pending domains, and will be enabled automatically after verified.') }}

    +

    {{ _('To verify domain ownership, please choose one of methods listed below:') }}

    +
      +
    • {{ _('Create a text file under top directory of your web site, both file name and file content must be same as verify code') }}
    • +
    • {{ _('Create a TXT type DNS record of the domain name, use the verify code as its value') }}
    • +
    + +
    + + + + + + + {% if session.get('is_global_admin') %} + + {% endif %} + + + + + + + {% if ownership_verify_codes %} + {% for r in ownership_verify_codes %} + {% if r.alias_domain %} + {% set verify_domain = r.alias_domain |e |lower %} + {% else %} + {% set verify_domain = r.domain |e |lower %} + {% endif %} + + + + + + {% set verify_code = r.verify_code |e %} + + {% set tip_http = 'http://' + verify_domain + '/' + verify_code %} + {% set tip_https = 'https://' + verify_domain + '/' + verify_code %} + {% set tip_dns = 'nslookup -type=txt ' + verify_domain %} + + {% set tooltip = "
      " + + "
    • " + _('Visit URLs below with a web browser should display verify code as page content:') + + ' ' + '
      ' + tip_http + '
      ' + '
      ' + + '
      ' + tip_https + '
      ' + '
    • ' + + "
    • " + _('DNS query result should contain the verify code:') + + '
      ' + tip_dns + '
    • ' + + "
    " + %} + + + + + {% if session.get('is_global_admin') %} + + {% endif %} + + + + + {% endfor %} + {% else %} + + + + + {% endif %} + +
    {{ _('Domain') }}{{ _('Verify code') }}{{ _('Admin') }}{{ _('Last verify status') }}{{ _('Last verify time') }}
    + + {{ verify_domain }}{{ verify_code |e }}{% if r.admin %}{{ r.admin |e }}{% endif %}{% if r.message %}{{ r.message |e }}{% endif %}{% if r.last_verify %}{{ r.last_verify |set_datetime_format | utc_to_timezone(timezone=session['timezone']) }}{% endif %}
    {{ _('No pending mail domain ownership verification.') }}
    + + {% if ownership_verify_codes %} + + {% endif %} +
    +
    +
    +
    +
    +{% endblock main %} diff --git a/templates/default/panel/license.html b/templates/default/panel/license.html new file mode 100644 index 0000000..ab500e6 --- /dev/null +++ b/templates/default/panel/license.html @@ -0,0 +1,93 @@ +{% extends "layout.html" %} + +{% block title %}{{ _('License') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} +{% block main %} + +
    +
    +
    +

    {{ _('License') }}

    +
    + +
    +
    +
    + {% if info is defined %} +
    +

    {{ _('License status') }}

    + + {% if info['status'] == 'active' %} + {{ _('License is active') }} + {% elif info['status'] == 'expired' %} + {{ _('Expired') }} + {% endif %} + +
    + +
    +

    {{ _('Product name') }}

    + {{ info['product'] }} +
    + +
    +

    {{ _('License Key') }}

    + {{ info['licensekey'] }} +
    + +
    +

    {{ _('Purchase date') }}

    + {{ info['purchased'] }} +
    + +
    +

    {{ _('Expire date') }}

    + + {{ info['expired'] }} + {% if info['expired'] == '2099-12-31' %} + ({{ _('Lifetime license') }}) + {% endif %} + +
    + +
    +

    {{ _('License owner(s)') }}

    + {{ info['contacts'] }} +
    + +
    +

    {{ _('Latest version') }}

    + {{ info['latestversion'] }} ({{ _('You are running version %s') |format(version |e) }}) +
    + + {% endif %} + + {% if error is defined %} + {{ _('Error while getting license info:') }} {{ error |e }} + {% endif %} +
    {# col2-3 #} + + {% if info is defined %} +
    +
    + +
    +
    {# col1-3 #} + {% endif %} +
    {# columns #} +
    {# box-wrap #} +
    {# box-body #} +
    {# content-box #} +{% endblock main %} diff --git a/templates/default/panel/log.html b/templates/default/panel/log.html new file mode 100644 index 0000000..f3e4168 --- /dev/null +++ b/templates/default/panel/log.html @@ -0,0 +1,143 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + show_pages, + show_event_name + with context + %} + +{% from "macros/msg_handlers.html" import log_msg_handler with context %} + +{% block title %}{{ _('Admin Log') }}{% endblock %} +{% block navlinks_activities %}class="active"{% endblock %} + +{% block main %} + +{{ log_msg_handler(msg) }} + +
    +
    +
    +

    {{ _('Admin Log') }} + {% if total > 0 %} + ({{ (cur_page-1)*page_size_limit + 1 }}-{{ (cur_page-1)*page_size_limit + (entries |length) }}/{{ total }}) + {% endif %} +

    +
    + +
    + +{# List all pages. #} +
    +
    + {{ _('Filter:') }} + + + {% if session.get('is_global_admin') %} + + {% endif %} + + + + +
    +
    + +{# List all logs #} +
    + {{ input_csrf_token() }} + + + + + + + + + {% if session.get('is_global_admin') %} + + {% endif %} + + + + + + + + {# List domain attributes/avalues. #} + + {% if entries |length > 0 %} + {% for log in entries %} + + {% if session.get('is_global_admin') %} + + {% endif %} + + + {% set log_admin = log.admin | string | e%} + {% if '@' in log_admin %} + + {% elif log_admin.startswith('cron_backup') %} + + {% elif log_admin == 'delete_mailboxes' %} + + {% else %} + + {% endif %} + + + + + {% endfor %} + {% else %} + + {% if session.get('is_global_admin') %} + + {% endif %} + + + {% endif %} + +
    {{ _('Time') }}{{ _('Admin') }}{{ _('IP Address') }}{{ _('Message') }}
    {{ log.timestamp |set_datetime_format | utc_to_timezone(timezone=session['timezone'])}}{{ log_admin }}{{ log_admin }}{{ log_admin }}{{ log_admin }}{{ log.ip |e }}{{ log.msg |e }}
    {{ _('No admin log.') }}
    + + +
    +
    +
    +{% endblock main %} diff --git a/templates/default/panel/settings.html b/templates/default/panel/settings.html new file mode 100644 index 0000000..15ee91a --- /dev/null +++ b/templates/default/panel/settings.html @@ -0,0 +1,159 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_text, + input_checkbox, + input_radios, + input_select, + input_textarea, + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + show_pages, + show_event_name + with context + %} + +{% from "macros/msg_handlers.html" import log_msg_handler with context %} + +{% block title %}{{ _('System Settings') }}{% endblock %} +{% block navlinks_system %}class="active"{% endblock %} + +{% block main %} + +
    +
    +
    +

    {{ _('System Settings') }}

    + + +
    {# .box-header #} + +
    +
    + {{ input_csrf_token() }} + +

    {{ _('Mailbox') }}

    +
    + + {% set mailbox_format_options = [ + ('maildir', _('Maildir (One message per file). Recommended.')), + ('mdbox', _('Mdbox (Multiple messages per file)')), + ] %} + +
    +
    + {{ input_radios(label=_('Default mailbox format'), + input_name='mailbox_format', + options=mailbox_format_options, + value=db_settings.get('mailbox_format')) }} + + {{ input_text(label=_('Default mailbox folder'), + input_name='mailbox_folder', + value=db_settings.get('mailbox_folder'), + comment=_('Only letters (case sensitive) and digits are allowed, max 20 chars.'), + size=20, + maxlength=20) }} + +
    + +
    +
    +
      +
    • {{ _('It affects newly created mailboxes, not existing ones.') }}
    • +
    • {{ _('Maildir is easy to migrate, backup and restore.') }}
    • +
    • {{ _('Mdbox has better performance, but corrupted/lost index files will cause data lose and can not be recovered.') }}
    • +
    +
    +
    {# .col1-3 #} +
    {# .columns #} + +

    {{ _('Password') }}

    +
    + + {{ input_text(label=_('Minimum password length'), + input_name='min_passwd_length', + value=db_settings.get('min_passwd_length'), + size=4) }} + + {{ input_text(label=_('Maximum password length'), + input_name='max_passwd_length', + value=db_settings.get('max_passwd_length'), + size=4) }} + + {{ input_checkbox(label=_('Require at least one letter'), + input_name='password_has_letter', + checked=db_settings.get('password_has_letter')) }} + + {{ input_checkbox(label=_('Require at least one uppercase letter'), + input_name='password_has_uppercase', + checked=db_settings.get('password_has_uppercase')) }} + + {{ input_checkbox(label=_('Require at least one digit number'), + input_name='password_has_number', + checked=db_settings.get('password_has_number')) }} + + {{ input_checkbox(label=_('Require at least one special character'), + input_name='password_has_special_char', + checked=db_settings.get('password_has_special_char')) }} + +

    {{ _('Login Restrictions') }}

    +
    + + {{ input_textarea(label=_('All admins can only login from specified IP addresses or networks'), + input_name='admin_login_ip_list', + value=db_settings.get('admin_login_ip_list'), + is_list_of_ip_or_network=true, + rows=4) }} + + {{ input_textarea(label=_('Global admin can only login from specified IP addresses or networks'), + input_name='global_admin_ip_list', + value=db_settings.get('global_admin_ip_list'), + is_list_of_ip_or_network=true, + rows=4) }} + + {{ input_textarea(label=_('RESTful API is accessible only from specified IP addresses or networks'), + input_name='restful_api_clients', + value=db_settings.get('restful_api_clients'), + is_list_of_ip_or_network=true, + rows=4) }} + +

    {{ _('Data Clean Up') }}

    +
    + + {{ input_text(label=_('Remove log of inbound/outbound mails older than'), + input_name='amavisd_remove_maillog_in_days', + value=db_settings.get('amavisd_remove_maillog_in_days'), + comment=_('Days'), + comment_as_text=true, + size=4) }} + + {{ input_text(label=_('Remove quarantined mails older than'), + input_name='amavisd_remove_quarantined_in_days', + value=db_settings.get('amavisd_remove_quarantined_in_days'), + comment=_('Days'), + comment_as_text=true, + size=4) }} + + {{ input_submit() }} +
    +
    {# .box-wrap #} +
    {# .box-body #} +
    {# .content-box #} + +{% endblock main %} diff --git a/templates/default/sql/admin/create.html b/templates/default/sql/admin/create.html new file mode 100644 index 0000000..ba6894c --- /dev/null +++ b/templates/default/sql/admin/create.html @@ -0,0 +1,74 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_random_password, + display_preferred_language, + display_add_admin, + display_domain_creation_options_of_normal_admin + with context %} + +{% from "macros/msg_handlers.html" import admin_msg_handler with context %} + +{% block navlinks_create %}class="active"{% endblock %} + +{% block title %}{{ _('Add admin') }}{% endblock title %} + +{% block main %} +{# Show system message #} +{% if msg %} + {% if msg.startswith('PW_') %} + {% set _pw_errors = msg.split(',') %} + {% for _err in _pw_errors %} + {{ admin_msg_handler(_err) }} + {% endfor %} + {% else %} + {{ admin_msg_handler(msg) }} + {% endif %} +{% endif %} + +
    +
    +
    + {# -- Tabs -- #} + + +

    {{ _('Add admin') }}

    +
    + +
    +
    +
    +
    + {{ input_csrf_token() }} + {{ display_add_admin(min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length, + lang=default_language, + languagemaps=languagemaps) }} + + {{ display_domain_creation_options_of_normal_admin(admin_settings={}) }} + + {{ input_submit(label=_('Add')) }} +
    +
    +
    + +
    +
    + {{ display_random_password(password_length=min_passwd_length, + password_policies=password_policies) }} +
    +
    +
    +
    +
    + +{% endblock main %} diff --git a/templates/default/sql/admin/list.html b/templates/default/sql/admin/list.html new file mode 100644 index 0000000..5f54aab --- /dev/null +++ b/templates/default/sql/admin/list.html @@ -0,0 +1,118 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + set_account_status_img, + highlight_username_in_mail, + set_admin_type_img, + show_pages + with context + %} +{% from "macros/msg_handlers.html" import admin_msg_handler with context %} + +{% block title %}{{ _('Domain Admins') }}{% endblock %} +{% block navlinks_admins %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ admin_msg_handler(msg) }} + +{# List admins #} + +{#{% if admins|length > 0 %}#} +{% if admins is not string %} +
    +
    +
    + {% if session.get('is_global_admin') %} + + {% endif %} + +

    {{ _('All admins') }} + {% if total is defined and admins|length > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + admins|length}}/{{ total }}) + {% endif %} +

    +
    + +
    + {{ input_csrf_token() }} + + + + + + + + + + + + + {% for r in admins %} + {% set mail = r.username |e %} + {% set name = r.name |e %} + + + + + + {% if r.get('isglobaladmin') is not sameas none %} + {# users marked as admin #} + {% if r.get('isglobaladmin') == 1 %} + + {% else %} + + {% endif %} + {% else %} + {# Separate admin accounts #} + {% if mail in allGlobalAdmins %} + + {% else %} + + {% endif %} + {% endif %} + + {% endfor %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('Global Admin') }}
    + + + + {{ set_account_status_img(r.active) }} + + {# -- Show name -- #} + {% if name == '' %}{{ mail.split('@', 1)[0] }}{% else %}{{ name |cut_string }}{% endif %} + {{ mail }}{{ set_admin_type_img('yes') }}{{ set_admin_type_img('no') }}{{ set_admin_type_img('yes') }}{{ set_admin_type_img('no') }}
    + + +
    + +
    {# -- box body -- #} +
    {# -- content box -- #} +{% endif %} + +{% endblock main %} diff --git a/templates/default/sql/admin/profile.html b/templates/default/sql/admin/profile.html new file mode 100644 index 0000000..415adbc --- /dev/null +++ b/templates/default/sql/admin/profile.html @@ -0,0 +1,165 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + display_account_status, + display_input_cn, + display_preferred_language, + display_timezones, + display_reset_password, + display_random_password, + display_input_global_admin, + display_domain_creation_options_of_normal_admin + with context + %} + +{% from "macros/sql.html" import + display_all_domains + with context + %} + +{% from "macros/msg_handlers.html" import admin_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_admins %}class="active"{% endblock %} + +{% block breadcrumb %} + {% if session.get('is_global_admin') %} + {% set crumbs = [(ctx.homepath + '/admins', _('All admins')), + ('active', ctx.homepath + '/profile/admin/general/' + mail, _('Profile of admin:') + ' ' + mail)] %} + {% else %} + {% set crumbs = [('active', ctx.homepath + '/profile/admin/general/' + mail, _('Profile of admin:') + ' ' + mail)] %} + {% 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 %} + {{ admin_msg_handler(_err) }} + {% endfor %} + {% else %} + {{ admin_msg_handler(msg) }} + {% endif %} +{% endif %} + +{% set navlinks = [ + ('general', _('General'), []), + ('password', _('Password'), []), + ] + %} + +
    +
    +
    +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    + +

    {{ _('Profile of admin:') }} {{ mail }}

    +
    + +
    +
    +
    + {{ input_csrf_token() }} + +
    +
    + {% if session.get('is_global_admin') %} + {{ display_account_status(profile.active) }} + {% endif %} + + {{ display_input_cn(value=profile.name, account_type='admin') }} + {{ display_preferred_language(value=profile.get('language', 'en_US') |e, + languagemaps=languagemaps) }} + {{ display_timezones(value=admin_settings.get('timezone'), timezones=timezones) }} + + {% if session.get('is_global_admin') %} +
    + {{ display_input_global_admin(value=is_global_admin) }} + {% endif %} +
    + + {% if session.get('is_global_admin') %} +
    + {{ display_domain_creation_options_of_normal_admin(admin_settings=admin_settings) }} +
    + +
    +
    +

    {{ _('All domains managed by this admin share the mailbox quota and limit of mail accounts.') }}

    +
    +
    {# .col1-3 #} + {% endif %} + + {% if session.get('is_global_admin') %} + {{ display_all_domains(managedDomains=managedDomains, allDomains=allDomains) }} + {% endif %} +
    {# .columns #} + + {{ input_submit() }} +
    +
    + +
    +
    + {{ input_csrf_token() }} +
    +
    + {% if session.get('is_global_admin') %} + {{ display_reset_password( + min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length, + show_confirmpw=true, + store_password_in_plain_text=store_password_in_plain_text) }} + {% else %} + {{ display_reset_password( + min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length, + show_oldpw=true, + show_confirmpw=true, + store_password_in_plain_text=store_password_in_plain_text) }} + {% endif %} +
    + +
    + {{ display_random_password(password_length=min_passwd_length, + password_policies=password_policies) }} +
    +
    + + {{ input_submit() }} +
    +
    +
    {# .box-wrap #} +
    {# .box-body #} +
    {#-- .content-box --#} +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/alias/create.html b/templates/default/sql/alias/create.html new file mode 100644 index 0000000..0453d37 --- /dev/null +++ b/templates/default/sql/alias/create.html @@ -0,0 +1,135 @@ +{% 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_list_access_policies + with context %} + +{% from "macros/msg_handlers.html" import alias_msg_handler, warning_info with context %} + +{% block title %}{{ _('Add mail alias') }}{% 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 #} +{{ alias_msg_handler(msg) }} + +{% set createNewAccount = true %} + +{% set numberOfSpareAccounts = profile.aliases - num_existing_aliases %} +{% if profile.aliases == -1 %} + {% set createNewAccount = false %} + {% set whyDisabledCreation = _('Not allowed to create mail alias under this domain.') %} +{% elif profile.aliases > 0 and numberOfSpareAccounts <= 0 %} + {% set createNewAccount = false %} + {% set whyDisabledCreation = _('Already exceed max number of account limit (%d).') |format(profile.aliases |int) %} +{% endif %} + +{% if not createNewAccount %} +
    +

    + {{ _('Error:') }} {{ _("You can't create mail aliases under domain %s.") |format('' + cur_domain + '') }} + {{ whyDisabledCreation }} +

    +
    +{% else %} + {% if profile.aliases > 0 and numberOfSpareAccounts > 0 %} +
    +

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

    +
    + {% endif %} +{% endif %} + +
    +
    +
    + + +

    + {{ _('Add mail alias') }} + +

    +
    + +
    +
    + {{ warning_info( _("It's better create a subscribable mailing list, so that you can restrict the mail posting and delivery.") ) }} +
    + {{ input_csrf_token() }} + +
    +

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

    + + + +
    + +
    +

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

    + + @{{ cur_domain }} + +
    + + {{ display_input_cn(value=cn, enable_input=createNewAccount) }} + +
    + {{ display_list_access_policies(policy=None, enable_input=createNewAccount) }} + +
    +
    +

     

    + + + +
    +
    +
    {# .columns #} +
    {# .box-wrap #} +
    {# .content-box #} +
    {# .box-body #} + +{% endblock main %} diff --git a/templates/default/sql/alias/list.html b/templates/default/sql/alias/list.html new file mode 100644 index 0000000..e38e88e --- /dev/null +++ b/templates/default/sql/alias/list.html @@ -0,0 +1,152 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + set_account_activity_img, + highlight_username_in_mail, + display_filter_by_first_char, + display_list_access_policy_name, + show_pages + with context + %} + +{% from "macros/msg_handlers.html" import alias_msg_handler with context %} + +{% block title %}{{ _('Mail Aliases') }}{% endblock %} +{% block navlinks_domains %}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')), + ('active', ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), + ] %} + + {% if session.get('is_global_admin') %} + {% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} + {% endif %} + + {% 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 #} +{{ alias_msg_handler(msg) }} + +{% if aliases is defined %} + + {% if aliases or (not aliases and first_char) %} + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/aliases/' + cur_domain, + available_chars=all_first_chars, + first_char=first_char, + disabled_only=disabled_only) }} + {% endif %} + +
    +
    +
    + + +

    + {{ _('Aliases under domain: %s.') |format(cur_domain) }} + {% if total is defined and aliases %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + aliases|length}}/{{total}}) + {% endif %} + + + {{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }} +

    +
    {# -- box-header -- #} + + {# List all aliases. #} +
    + {{ input_csrf_token() }} + + + + + + + + + + + {# List alias attributes/avalues. #} + + + {% if aliases |length > 0 %} + {% for r in aliases %} + {% set address = r.address |e %} + {% set name = r.name |e %} + + + + + + + {% endfor %} + {% else %} + + + + + {% endif %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('Mail Deliver Restriction') }}
    + + {{ set_account_status_img(r.active) }} + {% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(address) }}{{ display_list_access_policy_name(policy=r.accesspolicy) }}
    {{ _('No mail alias available.') }} + {% if not first_char %} + {{ _('Add one') }}? + {% endif %} +
    + + {% if aliases %} + + {% endif %} +
    + +
    {# -- box-body -- #} +
    {# -- content-body -- #} +{% endif %} +{% endblock main %} diff --git a/templates/default/sql/alias/profile.html b/templates/default/sql/alias/profile.html new file mode 100644 index 0000000..c8dc126 --- /dev/null +++ b/templates/default/sql/alias/profile.html @@ -0,0 +1,142 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + display_input_cn, + display_change_email_address, + display_migrate_alias_to_ml, + display_account_status, + set_account_status_img, + display_list_access_policies + with context + %} + +{% from "macros/msg_handlers.html" import alias_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_domains %}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')), + ('active', ctx.homepath + '/profile/alias/general/' + mail, _('Profile of alias:') + ' ' + mail), + (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 #} +{{ alias_msg_handler(msg) }} + +{% set navlinks = [ + ('general', _('General'), [true,]), + ] + %} + +
    +
    +
    +

    {{ _('Profile of alias:') }} {{ mail }}

    + +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    +
    {# -- box-header -- #} + + {# modal window used to change email address #} + {{ display_change_email_address(current_domain=cur_domain, + post_url=ctx.homepath + '/profile/alias/rename/' + mail ) }} + {{ display_migrate_alias_to_ml(mail=mail) }} + +
    +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_account_status(profile.active) }} + {{ display_input_cn(value=profile.name) }} +
    + + +
    + +
    +
    +
    + + {# -- Access policy -- #} + {% set accessPolicy = profile.get('accesspolicy', 'public').lower() |e %} + {% if accessPolicy == '' %} + {% set accessPolicy = 'public' %} + {% endif %} + + {{ display_list_access_policies(policy=accessPolicy) }} +
    {# col3-4 #} +
    {# .columns #} + +
     
    + + {# List all members. #} +
    +

    {{ _('Members') }} 

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    {#-- .form-field --#} + + +
     
    + {# List all moderators. #} +
    +

    {{ _('Moderators') }} 

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    {#-- .form-field --#} + + {{ input_submit() }} +
    +
    {# #profile_general #} +
    {#-- .box-wrap --#} +
    {#-- .box-body --#} +
    {#-- .content-box --#} + +{% endblock main %} diff --git a/templates/default/sql/domain/create.html b/templates/default/sql/domain/create.html new file mode 100644 index 0000000..d9c87cf --- /dev/null +++ b/templates/default/sql/domain/create.html @@ -0,0 +1,62 @@ +{% extends "layout.html" %} + +{% from "macros/general.html" import display_add_domain with context %} + +{% from "macros/msg_handlers.html" import + domain_msg_handler, + creation_limit_msg_handler + with context %} + +{% block title %}{{ _('Add domain') }}{% endblock title %} +{% block navlinks_create %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ domain_msg_handler(msg) }} + +{% if creation_limits['error_code'] %} + {% for err in creation_limits['error_code'] %} + {{ creation_limit_msg_handler(err) }} + {% endfor %} +{% endif %} + +{% if creation_limits['create_new_domain'] %} + {# num_spare_domains: -1 means no limit #} + {% if creation_limits['num_spare_domains'] > 0 %} +
    +

    {{ _('You can create %d more mail domains (Existing: %d, Max: %d)') |format(creation_limits['num_spare_domains'], creation_limits['num_managed_domains'], creation_limits['num_max_domains']) }}

    +
    +
    + {% endif %} +{% endif %} + +
    +
    +
    +

    {{ _('Add domain') }}

    +
    + + {{ display_add_domain(label=false, + preferred_language=preferred_language, + languagemaps=languagemaps, + timezones=timezones, + create_new_domain=creation_limits['create_new_domain'], + num_max_domains=creation_limits['num_max_domains'], + num_managed_domains=creation_limits['num_managed_domains'], + num_spare_domains=creation_limits['num_spare_domains'], + num_max_quota=creation_limits['num_max_quota'], + num_allocated_quota=creation_limits['num_allocated_quota'], + num_spare_quota=creation_limits['num_spare_quota'], + num_max_users=creation_limits['num_max_users'], + num_allocated_users=creation_limits['num_allocated_users'], + num_spare_users=creation_limits['num_spare_users'], + num_max_aliases=creation_limits['num_max_aliases'], + num_allocated_aliases=creation_limits['num_allocated_aliases'], + num_spare_aliases=creation_limits['num_spare_aliases'], + num_max_lists=creation_limits['num_max_lists'], + num_allocated_lists=creation_limits['num_allocated_lists'], + num_spare_lists=creation_limits['num_spare_lists']) }} +
    +
    + +{% endblock main %} diff --git a/templates/default/sql/domain/list.html b/templates/default/sql/domain/list.html new file mode 100644 index 0000000..5f35eef --- /dev/null +++ b/templates/default/sql/domain/list.html @@ -0,0 +1,286 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + set_account_status_img, + set_account_activity_img, + set_alias_domain_img, + display_number_of_account_limited, + display_progress_bar, + display_filter_by_first_char, + display_add_domain, + show_pages, + display_remove_mailbox_days + with context + %} + +{% from "macros/msg_handlers.html" import domain_msg_handler with context %} + +{% block title %}{{ _('Domains and Accounts') }}{% endblock %} +{% block navlinks_domains %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ domain_msg_handler(msg) }} + + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/domains', + first_char=first_char, + available_chars=all_first_chars, + account_type='domain', + disabled_only=disabled_only) }} + + {# List all domains under control. #} +
    +
    +
    + {% if session.get('is_global_admin') or session.get('create_new_domains') %} + + {% endif %} + +

    + {{ _('All domains under your control.') }} {% if disabled_only %}({{ _('Disabled') }}){% endif %} + {% if total is defined and all_domain_profiles | length > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + all_domain_profiles | length}}/{{ total }}) + {% endif %} +

    +
    + +
    + {{ input_csrf_token() }} + + + + + {% if session.get('is_global_admin') or session.get('create_new_domains') %} + + {% endif %} + + + + + + + + + + + {% if all_domain_profiles %} + {% for r in all_domain_profiles %} + {% set domain = r.domain |e %} + + + {% if session.get('is_global_admin') or session.get('create_new_domains') %} + + {% endif %} + + + + + + {#-- Domain Quota --#} + + + {#-- Users --#} + + + {#-- Mailing list --#} + + + {#-- Aliases --#} + + + {% endfor %} + {% else %} + + {% if session.get('is_global_admin') or session.get('create_new_domains') %} + + + {% else %} + + {% endif %} + + {% endif %} + + +
    {{ _('Domain') }}{{ _('Display Name') }}{{ _('Quota') }}{{ _('Users') }}{{ _('Mailing Lists') }}{{ _('Aliases') }}
    + + + {{ domain }} + + + + + + + {% set _alias_domains = all_alias_domains.get(domain, []) %} + + {% set _pending_alias_domains = [] %} + {% for d in _alias_domains %} + {% if d in pending_domains %} + {% do _pending_alias_domains.append(d) %} + {% endif %} + {% endfor %} + + {{ set_account_activity_img('sent', 'domain', domain) }} + + {# Check whether domain is a real backup mx #} + {% set is_real_backupmx = false %} + {% if r.backupmx == 1 and r.transport.startswith('relay:') %} + {% set is_real_backupmx = true %} + {% endif %} + + {{ set_account_status_img(status=r.active, + account_type='domain', + is_relay=r.transport not in local_transports, + relay=r.transport, + backupmx=r.backupmx, + is_backupmx=is_real_backupmx) }} + + {{ set_alias_domain_img(alias_domains=_alias_domains) }} + + {% if (domain in pending_domains) or _pending_alias_domains %} + {{ _('PLEASE VERIFY OWNERSHIP') }} + + {% endif %} + {% if r.description %}{{ r.description |cut_string |e }}{% endif %} + {% set used_quota = domain_used_quota.get(domain, {}).get('size', 0) %} + + {% if r.maxquota > 0 %} + {% set percent_allocated = r.quota_count |convert_to_percentage(r.maxquota) %} + {% set percent_used_quota = (used_quota/1024/1024) |convert_to_percentage(r.maxquota) %} + {% if session.get('is_global_admin') %} + {#-- Link to domain profile page. --#} + {{ percent_allocated }}% ({{ used_quota | file_size_format }} / {{ r.quota_count |file_size_format(base_mb=True) }}) {{ display_number_of_account_limited(r.maxquota |file_size_format(base_mb=True)) }} + {% else %} + {{ percent_allocated }}% ({{ used_quota | file_size_format }} / {{ r.quota_count |file_size_format(base_mb=True) }}) {{ display_number_of_account_limited(r.maxquota |file_size_format(base_mb=True)) }} + {% endif %} + + {{ display_progress_bar(percent_used_quota, tooltip=_('Used'), style='thin') }} + {{ display_progress_bar(percent_allocated, tooltip=_('Allocated'), style='thin') }} + {% else %} + {% if session.get('is_global_admin') %} + {{ used_quota | file_size_format }} / {{ r.quota_count |file_size_format(base_mb=True) }} / {{ _('Unlimited') }} + {% else %} + {{ used_quota | file_size_format }} / {{ r.quota_count |file_size_format(base_mb=True) }} / {{ _('Unlimited') }} + {% endif %} + {% endif %} + + {% if r.num_existing_users %} + {% set num_existing_users = r.num_existing_users | int %} + {% else %} + {% set num_existing_users = 0 %} + {% endif %} + + {% if r.mailboxes > 0 %} + {% set percentOfNumberOfUsers = num_existing_users |convert_to_percentage(r.mailboxes) %} + + {{ percentOfNumberOfUsers }}% ({% if num_existing_users is not sameas none %}{{ num_existing_users }}{% else %}0{% endif %} {{ display_number_of_account_limited(r.mailboxes) }}) + {{ display_progress_bar(percentOfNumberOfUsers, style='thin') }} + {% elif r.mailboxes == -1 %} + {{ _('DISABLED') }} + {% else %} + {% if num_existing_users is not sameas none %}{{ num_existing_users }}{% else %}0{% endif %} + {% endif %} + + {% if r.num_existing_maillists %} + {% set num_existing_maillists = r.num_existing_maillists | int %} + {% else %} + {% set num_existing_maillists = 0 %} + {% endif %} + + {% if r.maillists > 0 %} + {% set percentOfNumberOfMaillists= num_existing_maillists |convert_to_percentage(r.maillists) %} + + {{ percentOfNumberOfMaillists }}% ({{ num_existing_maillists }} {{ display_number_of_account_limited(r.maillists) }}) + {{ display_progress_bar(percentOfNumberOfMaillists, style='thin') }} + {% elif r.maillists == -1 %} + {{ _('DISABLED') }} + {% else %} + {% if num_existing_maillists is not sameas none %}{{ num_existing_maillists }}{% else %}0{% endif %} + {% endif %} + + {% if r.num_existing_aliases %} + {% set num_existing_aliases = r.num_existing_aliases | int %} + {% else %} + {% set num_existing_aliases = 0 %} + {% endif %} + + {% if r.aliases > 0 %} + {% set percentOfNumberOfAliases = num_existing_aliases |convert_to_percentage(r.aliases) %} + + {{ percentOfNumberOfAliases }}% ({{ num_existing_aliases }} {{ display_number_of_account_limited(r.aliases) }}) + {{ display_progress_bar(percentOfNumberOfAliases, style='thin') }} + {% elif r.aliases == -1 %} + {{ _('DISABLED') }} + {% else %} + {% if num_existing_aliases is not sameas none %}{{ num_existing_aliases }}{% else %}0{% endif %} + {% endif %} +
    {{ _('No mail domain available.') }} + {% if not (first_char or disabled_only) %} + {{ _('Add one') }}? + {% endif %} + {{ _('No mail domain available.') }}
    + + +
    + +
    +
    + +{% endblock main %} diff --git a/templates/default/sql/domain/profile.html b/templates/default/sql/domain/profile.html new file mode 100644 index 0000000..da3b262 --- /dev/null +++ b/templates/default/sql/domain/profile.html @@ -0,0 +1,773 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token, + input_text + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + set_account_activity_img, + display_domain_cn, + display_preferred_language, + display_timezones, + display_account_status, + display_domain_backupmx, + display_relay, + display_sender_relayhost, + display_domain_quota, + display_domain_default_userquota, + display_domain_max_user_quota, + display_recipient_bcc, + display_sender_bcc, + display_disabled_account_profiles, + display_disabled_domain_mail_services, + display_per_account_wblist_all + with context + %} + +{% from "macros/sql.html" import + display_enabled_domain_services + with context %} + +{% from "macros/iredapd.html" import + display_throttle_setting, + display_greylisting_setting, + display_greylisting_whitelists + with context + %} + +{% from "macros/amavisd.html" import display_spam_policy with context %} +{% from "macros/msg_handlers.html" import domain_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_domains %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set crumbs = [ + (ctx.homepath + '/domains', _('All domains')), + ('active', ctx.homepath + '/profile/domain/general/' + cur_domain, _('Profile of 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 %} + + +{# Domain profile. #} +{% block main %} + +{% if pending_domains %} +
    +

    {{ _('Mail services are disabled for domain(s): %s, please verify domain ownership first.' | format(pending_domains |join(', '), ctx.homepath)) }}

    +
    +{% endif %} + +{# Show system message #} +{{ domain_msg_handler(msg) }} + +{% set enabled_services = domain_settings.get('enabled_services', []) %} +{% set disabled_mail_services = domain_settings.get('disabled_mail_services', []) %} +{% set disabled_domain_profiles = domain_settings.get('disabled_domain_profiles', []) %} +{% set disabled_user_profiles = domain_settings.get('disabled_user_profiles', []) %} +{% set disabled_user_preferences = domain_settings.get('disabled_user_preferences', []) %} + +{% if session.get('is_global_admin') %} + {% set navlinks = [ + ('general', _('General'), [true]), + ('bcc', _('BCC'), [true]), + ('relay', _('Relay'), [true]), + ('catchall', _('Catch-all'), [true]), + ('aliases', _('Aliases'), [true]), + ('throttle', _('Throttling'), [session.get('iredapd_enabled')]), + ('greylisting', _('Greylisting'), [session.get('iredapd_enabled')]), + ('wblist', _('White/Blacklist'), [session.get('amavisd_enable_policy_lookup')]), + ('spampolicy', _('Spam Policy'), [session.get('amavisd_enable_policy_lookup')]), + ('backupmx', _('Backup MX'), [true]), + ('advanced', _('Advanced'), [true]), + ] + %} +{% else %} + {% set navlinks = [ + ('general', _('General'), [true]), + ('bcc', _('BCC'), ['bcc' not in disabled_domain_profiles]), + ('relay', _('Relay'), ['relay' not in disabled_domain_profiles]), + ('catchall', _('Catch-all'), ['catchall' not in disabled_domain_profiles]), + ('aliases', _('Aliases'), ['aliases' not in disabled_domain_profiles]), + ('throttle', _('Throttling'), ['throttle' not in disabled_domain_profiles, session.get('iredapd_enabled')]), + ('greylisting', _('Greylisting'), ['greylisting' not in disabled_domain_profiles, session.get('iredapd_enabled')]), + ('wblist', _('White/Blacklist'), [(session.get('amavisd_enable_policy_lookup') and 'wblist' not in disabled_domain_profiles)]), + ('spampolicy', _('Spam Policy'), [(session.get('amavisd_enable_policy_lookup') and 'spampolicy' not in disabled_domain_profiles)]), + ('backupmx', _('Backup MX'), ['backupmx' not in disabled_domain_profiles]), + ('advanced', _('Advanced'), [true]), + ] + %} +{% endif %} + +
    +
    + + {#-- Links --#} +
    +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    +

    {{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }}

    +
    {# .box-header #} + +
    + {# profile_type: general #} +
    +
    + {{ input_csrf_token() }} + +
    +
    + {% if cur_domain not in pending_domains %} + {# normal admin, and not domain ownership verification required #} + {{ display_account_status(profile.active, account_type='domain') }} + {% endif %} + {{ display_domain_cn(cn=profile.description) }} +
    {# .col2-3 #} +
    + + {% if session.get('is_global_admin') or session.get('create_new_domains') %} +
    +
    + {{ display_domain_quota( + quota=profile.maxquota | int, + required=(session.get('create_new_domains') and (creation_limits['num_max_quota'] > 0)), + num_allocated_quota=creation_limits['num_allocated_quota'], + num_max_quota=creation_limits['num_max_quota'], + num_spare_quota=creation_limits['num_spare_quota'], + ) }} +
    {# .col2-3 #} + + {% if session.get('is_global_admin') %} +
    +
    +
      +
    • {{ _('Set to 0 for unlimited.') }}
    • +
    +
    +
    + {% endif %} +
    {# .columns #} + {% endif %} + +
     
    +
    +
    + {% set default_user_quota = domain_settings.get('default_user_quota', '0') | int %} + {% set max_user_quota = domain_settings.get('max_user_quota', 0) | int %} + + {{ display_domain_default_userquota(default_user_quota, max_user_quota=max_user_quota) }} + + {% if session.get('is_global_admin') %} + {{ display_domain_max_user_quota(max_user_quota) }} + {% endif %} +
    {# .col2-3 #} + + {% if session.get('is_global_admin') %} +
    +
    +
      +
    • {{ _('Domain admin cannot assign more than max quota to a mail user.') }}
    • +
    +
    +
    {# .col1-3 #} + {% endif %} +
    {# .columns #} + + {{ input_submit() }} +
    +
    + + {# profile_type: bcc #} + {% if session.get('is_global_admin') or 'bcc' not in disabled_domain_profiles %} +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_recipient_bcc(address=profile.rbcc_addr) }} + {{ display_sender_bcc(address=profile.sbcc_addr) }} +
    {#-- .col2-3 --#} + +
    +
    +
      +
    • {{ _('Multiple addresses are NOT supported.') }}
    • +
    • {{ _('Per-user bcc settings has higher priority than per-domain bcc settings.') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {#-- .columns --#} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: relay #} + {% if session.get('is_global_admin') or 'relay' not in disabled_domain_profiles %} +
    +
    + {{ input_csrf_token() }} + {{ display_relay(transport=profile.transport |string, + default_mta_transport=default_mta_transport, + is_backupmx=profile.backupmx) }} + +
    + {{ display_sender_relayhost(relayhost=profile.relayhost) }} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: catchall #} + {% if session.get('is_global_admin') or 'catchall' not in disabled_domain_profiles %} +
    +
    + {{ input_csrf_token() }} +
    +
    +
    +

    {{ _('Catch-all Addresses') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} + +
    +
    {#-- .col2-3 --#} + +
    +
    +

    {{ _('Catch-all address may receive many spam emails.') }}

    +
    + +
    +
      +
    • {{ _('Emails delivered to non-exist mail accounts will be forwarded to catch-all address(es).') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {#-- .columns --#} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: aliases #} + {% if session.get('is_global_admin') or 'aliases' not in disabled_domain_profiles %} +
    +
    + {{ input_csrf_token() }} + +
    +
    +
    +

    {{ _('Alias domains') }}

    + + {% if alias_domains %} + {% for d in alias_domains |sort %} + {% if not loop.first %} +
    +
    +

     

    + {% endif %} + + + {% if d in pending_domains %} {{ _('Domain ownership verification required') }}{% endif %} + {% endfor %} + {% else %} + + {% endif %} +
    + + {#-- Always display an empty input field to add new value --#} +
    + {% if domainAliasName |length == 0 %} +

     

    + {% else %} +

     

    + {% endif %} + +
    +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Emails sent to user@[ALIAS_DOMAIN] will be delivered to user@%s.') |format(cur_domain) }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {#-- .columns --#} + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: throttling #} + {% if session.get('is_global_admin') or 'throttle' not in disabled_domain_profiles %} + +
    +
    + {{ input_csrf_token() }} + + {% if session.get('iredapd_enabled') %} + {# Throttling with iRedAPD #} +
    + {{ input_csrf_token() }} + + {{ display_throttle_setting(account='@' + cur_domain, + setting=outbound_throttle_setting, + inout_type='outbound') }} + {{ display_throttle_setting(account='@' + cur_domain, + setting=inbound_throttle_setting, + inout_type='inbound', + with_left_border=true) }} + +
    +
    +
      +
    • {{ _('This throttle setting will be applied to all individual accounts under domain %s.') |format(cur_domain) }}
    • +
    • {{ _('You can set per-user throttling in account profile page.') }}
    • +
    • {{ _('Per-user throttle setting has higher priority.') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {# .columns #} + {% endif %} + + {{ input_submit() }} +
    +
    {# #profile_throttle #} + {% endif %} + + {# profile_type: greylisting, with iRedAPD #} + {% if session.get('is_global_admin') or 'greylisting' not in disabled_domain_profiles %} + + {% if session.get('iredapd_enabled') %} +
    +
    + {{ input_csrf_token() }} + + {{ display_greylisting_setting(account='@' + cur_domain, gl_setting=gl_setting) }} + {{ display_greylisting_whitelists(account='@' + cur_domain, gl_whitelists=gl_whitelists) }} + + {{ input_submit() }} +
    +
    + {% endif %} + {% endif %} + + {# wblist #} + {% if session.get('amavisd_enable_policy_lookup') and (session.get('is_global_admin') or ('wblist' not in disabled_domain_profiles)) %} +
    +
    + {{ input_csrf_token() }} + + {{ display_per_account_wblist_all(inbound_whitelists=whitelists, + inbound_blacklists=blacklists, + outbound_whitelists=outbound_whitelists, + outbound_blacklists=outbound_blacklists) }} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: spampolicy #} + {% if session.get('amavisd_enable_policy_lookup') and (session.get('is_global_admin') or ('spampolicy' not in disabled_domain_profiles)) %} +
    +
    + {{ input_csrf_token() }} + {{ display_spam_policy(account_type='domain', + spampolicy=spampolicy, + custom_ban_rules=custom_ban_rules, + global_spam_score=global_spam_score) }} + {{ input_submit() }} +
    +
    + {% endif %} + + {# profile_type: advanced #} +
    +
    + {{ input_csrf_token() }} + + {% if session.get('is_global_admin') or session.get('create_new_domains') %} +
    +
    +
    +   +

    {{ _('Number of max mail users') }} + {% if session.get('create_new_domains') %} + {% if creation_limits['num_max_users'] > 0 -%}*{% endif %} + {% endif %} +

    + + + {% if session.get('is_global_admin') %} + + {% elif session.get('create_new_domains') %} + {% if creation_limits['num_max_users'] > 0 %} + + {% endif %} + {% endif %} + +
    + +
    +

    {{ _('Number of max mail aliases') }} + {% if session.get('create_new_domains') %} + {% if creation_limits['num_max_aliases'] > 0 -%}*{% endif %} + {% endif %} +

    + + + {% if session.get('is_global_admin') %} + + {% elif session.get('create_new_domains') %} + {% if creation_limits['num_max_aliases'] > 0 %} + + {% endif %} + {% endif %} + +
    + +
    +

    {{ _('Number of max mailing lists') }} + {% if session.get('create_new_domains') %} + {% if creation_limits['num_max_lists'] > 0 -%}*{% endif %} + {% endif %} +

    + + + {% if session.get('is_global_admin') %} + + {% elif session.get('create_new_domains') %} + {% if creation_limits['num_max_lists'] > 0 %} + + {% endif %} + {% endif %} + +
    +
     
    +
    + +
    +
    +
      + {% if session.get('is_global_admin') %} +
    • {{ _('Set value to 0 or leave it empty for unlimited.') }}
    • +
    • {{ _('Set value to -1 means not allowed to create this kind of account.') }}
    • + {% elif session.get('create_new_domains') %} +
    • {{ _('Leave it empty to use max value.') }}
    • + {% endif %} +
    +
    +
    +
    + {% endif %} + + {# Password length #} + {% if session.get('is_global_admin') or ('password_policies' not in disabled_domain_profiles) %} +
    +
    + {% set min_passwd_length = domain_settings.get('min_passwd_length') %} + {% set max_passwd_length = domain_settings.get('max_passwd_length') %} + + {% if session.get('is_global_admin') %} + {% set comment_min_passwd_length = none %} + {% set comment_max_passwd_length = none %} + {% else %} + {% if global_min_passwd_length > 0 %} + {% set comment_min_passwd_length = _('Can not be shorter than') + ' ' + (global_min_passwd_length | string ) %} + {% else %} + {% set comment_min_passwd_length = none %} + {% endif %} + + {% if global_max_passwd_length > 0 %} + {% if global_min_passwd_length > 0 %} + {% set comment_max_passwd_length = _('Can not be shorter than') + ' ' + (global_min_passwd_length | string ) + ' ' + _('or longer than') + ' ' + (global_max_passwd_length | string) %} + {% else %} + {% set comment_max_passwd_length = _('Can not be longer than') + ' ' + (global_max_passwd_length | string) %} + {% endif %} + {% else %} + {% if global_min_passwd_length > 0 %} + {% set comment_max_passwd_length = _('Can not be shorter than') + ' ' + (global_min_passwd_length | string ) %} + {% else %} + {% set comment_max_passwd_length = none %} + {% endif %} + {% endif %} + {% endif %} + + {{ input_text(label=_('Minimum password length'), + input_name='minPasswordLength', + value=min_passwd_length, + size=8, + comment=comment_min_passwd_length, + comment_as_text=True) }} + + {{ input_text(label=_('Maximum password length'), + input_name='maxPasswordLength', + value=max_passwd_length, + size=8, + comment=comment_max_passwd_length, + comment_as_text=True) }} + +
    {# .col2-3 #} + +
    +
    +
      +
    • {{ _('Leave it empty to use server-wide default setting.') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {#-- .columns --#} + {% endif %} + +
    +
    +
    + {{ display_preferred_language( + value=domain_settings.get('default_language'), + languagemaps=languagemaps, + label=_('Default language for new user')) }} + {{ display_timezones(value=domain_settings.get('timezone'), timezones=timezones) }} +
    +
    + + {% if session.get('is_global_admin') or 'bcc' not in disabled_domain_profiles %} +
    +
    +
    + {{ display_recipient_bcc(address=domain_settings.get('default_recipient_bcc', ''), label=_('Default bcc address for incoming emails for new user')) }} + {{ display_sender_bcc(address=domain_settings.get('default_sender_bcc', ''), label=_('Default bcc address for outgoing emails for new user')) }} +
    + +
    +
    +
      +
    • {{ _('These addresses will be assigned to newly created mail user as per-user bcc address.') }}
    • +
    +
    +
    +
    + {% endif %} + +
    +
    +
    +

    {{ _('Default mailing list(s) of new user') }}

    +
    +
    + {% if domain_settings.get('default_mailing_lists', []) %} + {% set default_mailing_lists = domain_settings.get('default_mailing_lists') %} + {% else %} + {% set default_mailing_lists = [] %} + {% endif %} + + {# Show non-exist lists which still stored in default_mailing_lists #} + {% for addr in default_mailing_lists |sort %} + {% if addr and addr not in mails_of_all_mailing_lists %} +
    + + + + +
    +
    + {% endif %} + {% endfor %} + + {% for rcd in all_mailing_lists %} + +
    + {% endfor %} +
    +
    +
    +
    + + +
    + +
    +
    +
    +

    {{ _('Default mail alias(es) of new user') }}

    +
    +
    + {% if domain_settings.get('default_groups', []) %} + {% set default_groups = domain_settings.get('default_groups') %} + {% else %} + {% set default_groups = [] %} + {% endif %} + + {# Show non-exist lists which still stored in default_groups #} + {% for addr in default_groups |sort %} + {% if addr and addr not in mails_of_all_alias_accounts %} +
    + + + + +
    +
    + {% endif %} + {% endfor %} + + {% for rcd in all_alias_accounts %} + +
    + {% endfor %} +
    +
    +
    +
    + + +
    + +
    + {# Enabled services #} + {{ display_enabled_domain_services(enabled_services=enabled_services) }} + + {# Disabled per-domain mail services #} + {% if session.get('is_global_admin') or 'disabled_mail_services' not in disabled_domain_profiles %} +
    + {{ display_disabled_domain_mail_services(disabled_mail_services=disabled_mail_services) }} + {% endif %} + + {% if session.get('is_global_admin') %} +
    + {# Disabled domain profiles #} + {{ display_disabled_account_profiles(account_type='domain', + disabled_profiles=disabled_domain_profiles) }} + +
    + {# Disabled user profiles #} + {{ display_disabled_account_profiles(account_type='user', + disabled_profiles=disabled_user_profiles) }} + {% endif %} + +
    + {# Disabled user profiles #} + {{ display_disabled_account_profiles(account_type='user_preference', + disabled_profiles=disabled_user_preferences) }} + + {{ input_submit() }} +
    +
    + + {# profile_type: backupmx #} + {% if session.get('is_global_admin') or 'backupmx' not in disabled_domain_profiles %} +
    +
    + {{ input_csrf_token() }} + + {{ display_domain_backupmx(domain=cur_domain, + backupmx=profile.backupmx, + transport=profile.transport) }} + + {{ input_submit() }} +
    +
    + {% endif %} + +
    +
    +
    +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/ml/create.html b/templates/default/sql/ml/create.html new file mode 100644 index 0000000..2ec2fe1 --- /dev/null +++ b/templates/default/sql/ml/create.html @@ -0,0 +1,131 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import input_csrf_token with context %} + +{% from "macros/general.html" import + display_subnav, + display_input_cn + with context + %} + +{% from "macros/mlmmj.html" import display_maillist_basic_profile with context %} +{% from "macros/msg_handlers.html" import maillist_msg_handler with context %} + +{% block title %}{{ _('Add mailing list') }}{% 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 #} +{{ maillist_msg_handler(msg) }} + +{% set createNewAccount = true %} + +{% set numberOfSpareAccounts = profile.maillists - num_existing_maillists %} +{% if profile.maillists == -1 %} + {% set createNewAccount = false %} + {% set whyDisabledCreation = _('Not allowed to create mailing list under this domain.') %} +{% elif profile.maillists > 0 and numberOfSpareAccounts <= 0 %} + {% set createNewAccount = false %} + {% set whyDisabledCreation = _('Already exceed max number of account limit (%d).') |format(profile.maillists |int) %} +{% endif %} + +{% if not createNewAccount %} +
    +

    + {{ _('Error:') }} {{ _("You can't create mailing lists under domain %s.") |format('' + cur_domain + '') }} + {{ whyDisabledCreation }} +

    +
    +{% else %} + {% if profile.maillists > 0 and numberOfSpareAccounts > 0 %} +
    +

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

    +
    + {% endif %} +{% endif %} + +
    +
    +
    + + +

    {{ _('Add mailing list') }}

    +
    + +
    +
    +
    + {{ input_csrf_token() }} + +
    +

    {{ _('Add mailing list under domain') }} *

    + + + +
    + +
    +

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

    + + @{{ cur_domain }} + +
    + + {{ display_input_cn(value=cn, input_name='name', enable_input=createNewAccount) }} + + {{ display_maillist_basic_profile(profile=default_creation_settings) }} + +
    +
    +

     

    + + + +
    +
    +
    {# .columns #} +
    {# .box-wrap #} +
    {# .content-box #} +
    {# .box-body #} + +{% endblock main %} diff --git a/templates/default/sql/ml/list.html b/templates/default/sql/ml/list.html new file mode 100644 index 0000000..d2d38ab --- /dev/null +++ b/templates/default/sql/ml/list.html @@ -0,0 +1,155 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + set_account_activity_img, + highlight_username_in_mail, + display_filter_by_first_char, + display_list_access_policy_name, + show_pages + with context + %} + +{% from "macros/msg_handlers.html" import maillist_msg_handler with context %} + +{% block title %}{{ _('Mailing Lists') }}{% endblock %} +{% block navlinks_domains %}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')), + ('active', ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), + (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), + ] %} + + {% if session.get('is_global_admin') %} + {% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} + {% endif %} + + {% 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 #} +{{ maillist_msg_handler(msg) }} + +{% if maillists is defined %} + + {% if maillists or (not maillists and first_char) %} + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/mls/' + cur_domain, + available_chars=all_first_chars, + first_char=first_char, + disabled_only=disabled_only) }} + {% endif %} + +
    +
    +
    + + +

    + {{ _('Mailing lists under domain: %s.') |format(cur_domain) }} + {% if total is defined and maillists %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + maillists |length}}/{{total}}) + {% endif %} + + + {{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }} +

    +
    {# -- box-header -- #} + + {# List all mailing lists. #} +
    + {{ input_csrf_token() }} + + + + + + + + + + + + + {% if maillists|length > 0 %} + {% for r in maillists %} + {% set address = r.address |e %} + {% set name = r.name |e %} + {% set access_policy = r.accesspolicy |e %} + + + + + + + {% endfor %} + {% else %} + + + + + {% endif %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('Mail Deliver Restriction') }}
    + + + {{ set_account_status_img(r.active) }} + {% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(address) }}{{ display_list_access_policy_name(policy=access_policy) }}
    {{ _('No mailing list available.') }} + {% if not first_char %} + {{ _('Add one') }}? + {% endif %} +
    + + {% if maillists %} + + {% endif %} +
    + +
    {# -- box-body -- #} +
    {# -- content-body -- #} +{% endif %} +{% endblock main %} diff --git a/templates/default/sql/ml/profile.html b/templates/default/sql/ml/profile.html new file mode 100644 index 0000000..f862951 --- /dev/null +++ b/templates/default/sql/ml/profile.html @@ -0,0 +1,185 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + display_input_cn, + display_change_email_address, + display_account_status, + display_per_account_alias_addresses, + set_account_status_img + with context + %} + +{% from "macros/mlmmj.html" import + display_maillist_basic_profile, + display_maillist_owners, + display_maillist_moderators, + display_maillist_subscription_moderators, + display_modal_add_subscribers, + display_maillist_subscribers, + display_modal_newsletter_html_code, + display_maillist_newsletter_profile + with context + %} + +{% from "macros/msg_handlers.html" import maillist_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_domains %}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')), + ('active', ctx.homepath + '/profile/ml/general/' + mail, _('Profile of mailing list:') + ' ' + mail), + (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 #} +{{ maillist_msg_handler(msg) }} + +{% set navlinks = [ + ('general', _('General'), [true]), + ('aliases', _('Aliases'), [true]), + ('members', _('Members'), [true]), + ('owners', _('Owners and Moderators'), [true]), + ('newsletter', _('Newsletter'), [true]), + ] + %} + +{# modal window used to add subscriber #} +{% set form_post_url = ctx.homepath + "/profile/ml/add_subscribers/" + mail %} +{{ display_modal_add_subscribers(form_post_url=form_post_url) }} + +{% if profile.mlid %} + {{ display_modal_newsletter_html_code(mlid=profile.mlid) }} +{% endif %} + +
    +
    +
    +

    {{ _('Profile of mailing list:') }} {{ mail }} ({{ subscribers | length }} {{ _('Members') }})

    + +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    +
    {# -- box-header -- #} + +
    + +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_account_status(profile.active) }} + {{ display_input_cn(value=profile.name, input_name='name') }} +
    +
    + {% if profile.active %} + + {% else %} +
    +

    {{ _('To add new members, please enable mailing list account first.') }}

    +
    + {% endif %} +
    + +
    + +
    + {{ display_maillist_basic_profile(profile=profile, access_policy=profile.accesspolicy, mail=mail) }} +
    + + {{ input_submit() }} +
    +
    {# #profile_general #} + + {# Aliases #} +
    +
    + {{ input_csrf_token() }} + {{ display_per_account_alias_addresses(mail=mail, alias_addresses=alias_addresses) }} + {{ input_submit() }} +
    +
    + + {# + # Members + #} +
    +
    + {{ input_csrf_token() }} + {{ display_maillist_subscribers(mail=mail, subscribers=subscribers, account_is_enabled=profile.active) }} +
    +
    {# #profile_general #} + +
    +
    + {{ input_csrf_token() }} + + {# parameter name is 'owner', not 'owners' #} + {{ display_maillist_owners(mail=mail, addresses=profile.get('owner')) }} + +
    + {{ display_maillist_moderators(mail=mail, addresses=profile.get('moderators')) }} + +
    + {{ display_maillist_subscription_moderators(mail=mail, + profile=profile, + addresses=profile.get('subscription_moderators')) }} + + {{ input_submit() }} +
    +
    {# #profile_owners #} + +
    +
    + {{ input_csrf_token() }} + + {{ display_maillist_newsletter_profile(is_newsletter=profile.is_newsletter, + description=profile.description) }} + + {{ input_submit() }} +
    +
    {# #profile_newsletter #} + +
    {#-- .box-wrap --#} +
    {#-- .box-body --#} +
    {#-- .content-box --#} + +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/search.html b/templates/default/sql/search.html new file mode 100644 index 0000000..d67bb0e --- /dev/null +++ b/templates/default/sql/search.html @@ -0,0 +1,469 @@ +{# + @queryResult List which stores LDAP query results +#} + +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_progress_bar, + set_account_status_img, + set_account_activity_img, + set_alias_address_img, + set_forwarding_address_img, + set_assigned_groups_img, + set_admin_type_img, + highlight_username_in_mail, + display_number_of_account_limited, + display_remove_mailbox_days + with context %} + +{% from "macros/msg_handlers.html" import search_msg_handler with context %} + +{% block title %}{{ _('Search') }}{% endblock %} +{% block navlinks_active_search %}class="active"{% endblock %} + +{% block main %} + +{{ search_msg_handler(msg) }} + +
    +
    +
    +
    + {{ input_csrf_token() }} +
    +

    {{ _('Keyword') }} *

    + + +
    + +
    +

    {{ _('Account type') }}

    + + + + + {% if session.get('is_global_admin') %} + + + {% endif %} +
    + +
    +

    {{ _('Account status') }}

    + + + + + +
    + +
    +
    +
    +
    + +{% if total_results is defined %} +
    +
    +
    +

    {{ _('Search results.') }}

    +
    + +
    + {% if total_results > 0 %} + + {% if session.get('is_global_admin') %} + {% if domains |length > 0 %} +

    {{ _('%d domain(s) found.') |format(domains |length) }}

    +
    + {{ input_csrf_token() }} + + + + + + + + + + + + + + {% for r in domains %} + {% set domain = r.domain |e %} + + + + + {% if r.description %} + + {% else %} + + {% endif %} + + {# Quota #} + + + {# Mailboxes #} + + + {# Aliases #} + + + {% endfor %} + +
    {{ _('Domain') }}{{ _('Display Name') }}{{ _('Quota') }}{{ _('Users') }}{{ _('Aliases') }}
    + + {{ set_account_activity_img('sent', 'domain', domain) }} + {{ set_account_status_img(r.active) }} + {{ domain }} + {{ r.description |cut_string |e }}  + {{ display_number_of_account_limited(r.maxquota |file_size_format(base_mb=True), hide_unlimited=false, hide_slash=true) }} + + {% if (r.mailboxes |int) >= 0 %} + {{ display_number_of_account_limited(r.mailboxes, hide_unlimited=false, hide_slash=true) }} + {% elif (r.mailboxes |int) == -1 %} + {{ _('DISABLED') }} + {% endif %} + + {% if (r.aliases |int) >= 0 %} + {{ display_number_of_account_limited(r.aliases, hide_unlimited=false, hide_slash=true) }} + {% elif (r.aliases |int) == -1 %} + {{ _('DISABLED') }} + {% endif %} +
    + + +
    + +
    + {% endif %} {# domains #} + + + {% if admins |length > 0 %} +

    {{ _('%d admin(s) found.') |format(admins |length) }}

    + +
    + {{ input_csrf_token() }} + + + + + + + + + + + + + {% for r in admins %} + {% set username = r.username |e %} + {% set name = r.name |e %} + + + + + + {% if username in allGlobalAdmins %} + + {% else %} + + {% endif %} + + {% endfor %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('Global Admin') }}
    + + {{ set_account_status_img(r.active) }} + + {# -- Show name -- #} + {% if name == '' %} + {{ username.split('@', 1)[0] }} + {% else %} + {{ name |cut_string }} + {% endif %} + {{ username }}{{ set_admin_type_img('yes') }}{{ set_admin_type_img('no') }}
    + + +
    + +
    + {% endif %} {# admins #} + {% endif %} {# domainGlobalAdmin #} + + + + {# List all users. #} + {% if users %} +

    {{ _('%d user(s) found.') |format( users |length ) }}

    + +
    + {{ input_csrf_token() }} + + + + + + + + + + {% if last_logins %} + + {% endif %} + + + + + {% for r in users %} + {% set mail = r.username |e %} + + + + + + {% if (r.quota |int) == 0 %} + + {% else %} + + {% endif %} + + {# last login #} + {% if last_logins %} + {% if mail in last_logins %} + {% set _times = last_logins.get(mail, {}) %} + + {# values may be None, so we use `or 0` to set it to `0` #} + {% set _imap = _times.get('imap', 0) or 0 %} + {% set _pop3 = _times.get('pop3', 0) or 0 %} + {% set _lda = _times.get('lda', 0) or 0 %} + + {# imap or pop3 login time #} + {% set _login_time = 0 %} + {% set _login_service = None %} + + {% if (_imap > 0) and (_pop3 > 0) %} + {% if _imap > _pop3 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% else %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + {% elif _imap > 0 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% elif _pop3 > 0 %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + + + {% else %} + + {% endif %} + {% endif %} + + {% endfor %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('User/Employee ID') }}{{ _('Quota') }}{{ _('Last Login') }}
    + + {{ set_account_activity_img('sent', 'user', mail) }} + {{ set_account_status_img(r.active) }} + {{ set_assigned_groups_img(addresses=user_assigned_groups.get(mail, [])) }} + {{ set_forwarding_address_img(user=mail, addresses=user_forwarding_addresses.get(mail, [])) }} + {{ set_alias_address_img(addresses=user_alias_addresses.get(mail, [])) }} + {% if r.name %}{{ r.name |cut_string |e }}{% else %}{{ mail.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(mail) }}{% if r.employeeid %}{{ r.employeeid |e }}{% endif %}{{ _('Unlimited') }}{{ r.quota | file_size_format(base_mb=True) }} + {% if _login_time %} + + {{ _login_time | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }} + + {% if _login_service %} + {{ _login_service | upper }} + {% endif %} + + {% endif %} +
    + + +
    + +
    + {% endif %} + + + {# List all mailing lists. #} + {% if mls |length > 0 %} +

    {{ _('%d mailing list(s) found.') |format( mls |length ) }}

    + +
    + {{ input_csrf_token() }} + + + + + + + + + + + + {% for r in mls %} + {% set address = r.address |e %} + {% set name = r.name |e %} + {% set active = r.active |int %} + + + + + + {% endfor %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}
    + + {{ set_account_status_img(active) }} + {% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(address) }}
    + + +
    + {% endif %} + + + {# List all mail aliases. #} + {% if aliases |length > 0 %} +

    {{ _('%d mail alias(es) found.') |format( aliases |length ) }}

    + +
    + {{ input_csrf_token() }} + + + + + + + + + + + {# List alias attributes/avalues. #} + + {% for r in aliases %} + {% set address = r.address |e %} + {% set name = r.name |e %} + + + + + + {% endfor %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}
    + + {{ set_account_status_img(r.active) }} + {% if name %}{{ name |cut_string |e }}{% else %}{{ address.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(address) }}
    + + +
    + {% endif %} + {% else %} +

    {{ _('Your search returned no hits.') }}

    + {% endif %} +
    {# .box-wrap #} +
    {# .box-body #} +
    {# .content-box #} +{% endif %} + +{% endblock main %} diff --git a/templates/default/sql/self-service/ml/list.html b/templates/default/sql/self-service/ml/list.html new file mode 100644 index 0000000..e135943 --- /dev/null +++ b/templates/default/sql/self-service/ml/list.html @@ -0,0 +1,74 @@ +{% extends "layout_user.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + highlight_username_in_mail, + display_filter_by_first_char, + display_list_access_policy_name, + show_pages + with context + %} + +{% from "macros/sql.html" import + display_mls + with context + %} + +{% from "macros/msg_handlers.html" import maillist_msg_handler with context %} + +{% block title %}{{ _('Mailing Lists') }}{% endblock %} +{% block navlinks_manageml %}class="active"{% endblock %} + +{% block main %} +{# Show system message #} +{{ maillist_msg_handler(msg) }} + +{% if maillists %} + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/self-service/mls', + account_type="managed_ml", + available_chars=all_first_chars, + first_char=first_char, + disabled_only=False) }} +{% endif %} + +
    +
    +
    +

    + {{ _('Managed mailing lists.') }} + {% if total > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + (maillists |length) }}/{{total}}) + {% endif %} +

    +
    + + {# List all mailing lists. #} +
    + {{ input_csrf_token() }} + + {{ display_mls(maillists=maillists, + profile_base_url=ctx.homepath + "/self-service/ml/profile", + domain=None) }} + + {% if maillists %} + + {% endif %} +
    + +
    {# -- box-body -- #} +
    {# -- content-body -- #} +{% endblock main %} diff --git a/templates/default/sql/self-service/ml/profile.html b/templates/default/sql/self-service/ml/profile.html new file mode 100644 index 0000000..f48ec43 --- /dev/null +++ b/templates/default/sql/self-service/ml/profile.html @@ -0,0 +1,127 @@ +{% extends "layout_user.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + display_input_cn, + with context + %} + +{% from "macros/mlmmj.html" import + display_maillist_basic_profile, + display_modal_add_subscribers, + display_maillist_subscribers, + display_modal_newsletter_html_code, + display_maillist_newsletter_profile + with context + %} + +{% from "macros/msg_handlers.html" import maillist_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_manageml %}class="active"{% endblock %} + +{% block main %} + +{# Show system message #} +{{ maillist_msg_handler(msg) }} + +{% set navlinks = [ + ('general', _('General'), [true]), + ('members', _('Members'), [true]), + ('newsletter', _('Newsletter'), [true]), + ] + %} + +{# modal window used to add subscriber #} +{% set form_post_url = ctx.homepath + "/self-service/ml/profile/add_subscribers/" + mail %} +{{ display_modal_add_subscribers(form_post_url=form_post_url) }} + +{% if profile.mlid %} + {{ display_modal_newsletter_html_code(mlid=profile.mlid) }} +{% endif %} + +
    +
    +
    +

    {{ _('Profile of mailing list:') }} {{ mail }} ({{ subscribers | length }} {{ _('Members') }})

    + +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    +
    {# -- box-header -- #} + +
    +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_input_cn(value=profile.name, input_name='name') }} +
    +
    + {% if profile.active %} + + {% else %} +
    +

    {{ _('To add new members, please enable mailing list account first.') }}

    +
    + {% endif %} +
    + +
    + +
    + {{ display_maillist_basic_profile(profile=profile, access_policy=profile.accesspolicy, mail=mail) }} +
    + + {{ input_submit() }} +
    +
    {# #profile_general #} + + {# + # Members + #} +
    +
    + {{ input_csrf_token() }} + {{ display_maillist_subscribers(mail=mail, subscribers=subscribers, account_is_enabled=profile.active) }} +
    +
    {# #profile_general #} + +
    +
    + {{ input_csrf_token() }} + + {{ display_maillist_newsletter_profile(is_newsletter=profile.is_newsletter, + description=profile.description) }} + + {{ input_submit() }} +
    +
    {# #profile_newsletter #} + +
    {#-- .box-wrap --#} +
    {#-- .box-body --#} +
    {#-- .content-box --#} + +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/self-service/user/preferences.html b/templates/default/sql/self-service/user/preferences.html new file mode 100644 index 0000000..a6a6a56 --- /dev/null +++ b/templates/default/sql/self-service/user/preferences.html @@ -0,0 +1,138 @@ +{% extends "layout_user.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_activity_img, + display_progress_bar, + display_input_cn, + display_preferred_language, + display_timezones, + display_account_status, + display_reset_password, + display_random_password, + display_user_forwarding + with context + %} + +{% from "macros/msg_handlers.html" import user_msg_handler with context %} + +{% block title %}{{ _('Preferences') }}{% endblock %} +{% block navlinks_preferences %}class="active"{% 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 %} + + +{% set navlinks = [('general', _('General'), [true]), + ('forwarding', _('Forwarding'), ['forwarding' not in disabled_user_preferences]), + ('password', _('Password'), ['password' not in disabled_user_preferences])] +%} + +
    +
    + +
    +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    +

    {{ _('Preferences') }}

    +
    + +
    +
    +
    + {{ input_csrf_token() }} +
    +
    + {% if 'personal_info' not in disabled_user_preferences %} + {{ display_input_cn(value=profile.name) }} + {% endif %} + {{ display_preferred_language(value=profile.get('language'), languagemaps=languagemaps) }} + {{ display_timezones(value=user_settings.get('timezone'), timezones=timezones) }} +
    + + {% if profile.quota %} +
    +
    + {% set percent = used_quota_bytes |convert_to_percentage(profile.quota |int * 1024 * 1024) %} +

    {{ _('Mailbox Quota') }} ({{ profile.quota | file_size_format(base_mb=True) }}, {{ percent }}% {{ _('Used') }})

    + {{ display_progress_bar(percent, style='thin', show_zero=true, width='70%') }} +
     
    +
    +
    + {% endif %} +
    + {{ input_submit() }} +
    +
    + + {% if 'forwarding' not in disabled_user_preferences %} +
    +
    + {{ input_csrf_token() }} +
    + {{ display_user_forwarding(mail=mail, + enabled=profile.alias_active, + forwarding_addresses=profile.forwardings) }} +
    {#-- .columns --#} + + {{ input_submit() }} +
    +
    + {% endif %} + + {% if 'password' not in disabled_user_preferences %} +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_reset_password(show_confirmpw=true, + min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length, + store_password_in_plain_text=store_password_in_plain_text) }} +
    + +
    + {{ display_random_password(password_length=min_passwd_length, + password_policies=password_policies) }} +
    +
    + + {{ input_submit() }} +
    +
    + {% endif %} +
    +
    +
    +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/user/all_last_logins.html b/templates/default/sql/user/all_last_logins.html new file mode 100644 index 0000000..2c6b94d --- /dev/null +++ b/templates/default/sql/user/all_last_logins.html @@ -0,0 +1,167 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + set_forwarding_address_img, + with context + %} + +{% from "macros/msg_handlers.html" import user_msg_handler with context %} + +{% block title %}{{ _('Last Logins') }}{% endblock %} +{% block navlinks_domains %}class="active"{% endblock %} + +{% block breadcrumb %} + {% if all_are_admins %} + {% 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')), + ] + %} + {% else %} + {% 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')), + ] %} + + {% if session.get('is_global_admin') %} + {% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} + {% endif %} + {% endif %} + + {% if backend != "pgsql" %} + {% set crumbs = crumbs + [('active', ctx.homepath + '/users/' + cur_domain + '/last_logins', _('Last Logins'))] %} + {% endif %} + + {{ display_subnav(crumbs) }} +{% endblock %} + +{% block main %} + +{# Show system message #} +{{ user_msg_handler(msg) }} + +
    +
    +
    +

    {{ _("Last Logins") }}

    +
    + +
    +
    + + + + + + + + + + + + + {% if last_logins %} + {% for email in last_logins %} + {% set active = last_logins[email]["active"] %} + {% set forwardings = last_logins[email]["forwardings"] %} + {% set name = last_logins[email]["name"] %} + {% set imap = last_logins[email]["imap"] %} + {% set pop3 = last_logins[email]["pop3"] %} + {% set lda = last_logins[email]["lda"] %} + + + + + + + + + + + + + + {% endfor %} + {% else %} + + + + {% endif %} + +
    {{ _("Display Name") }}{{ _("Mail Address") }}IMAPPOP3{{ _("Last Email Delivery") }}
    {% if name %}{{ name | e }}{% endif %} + {{ email }} + + {{ set_account_status_img(active) }} + {% if forwardings %} + {{ set_forwarding_address_img(email, forwardings) }} + {% endif %} + + {% if imap > 0 %} + {{ imap | epoch_seconds_to_gmt | utc_to_timezone(timezone=session['timezone']) }} + {% endif %} + + {% if pop3 > 0 %} + {{ pop3 | epoch_seconds_to_gmt | utc_to_timezone(timezone=session['timezone']) }} + {% endif %} + + {% if lda > 0 %} + {{ lda | epoch_seconds_to_gmt | utc_to_timezone(timezone=session['timezone']) }} + {% endif %} + + {% if active %} + {{ _("Disable") }} + {% endif %} +
    {{ _("No any login or mail delivery yet.") }}
    +
    {# .all_last_logins #} + +
    {# .box-wrapper #} +
    {# .box-body #} +
    {# .content-box #} +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %} diff --git a/templates/default/sql/user/create.html b/templates/default/sql/user/create.html new file mode 100644 index 0000000..8477aa6 --- /dev/null +++ b/templates/default/sql/user/create.html @@ -0,0 +1,186 @@ +{% 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 %} + +
    +
    +
    + + +

    {{ _('Add mail user') }}

    +
    + +
    +
    + {{ 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 %} diff --git a/templates/default/sql/user/list.html b/templates/default/sql/user/list.html new file mode 100644 index 0000000..f0853a0 --- /dev/null +++ b/templates/default/sql/user/list.html @@ -0,0 +1,332 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_status_img, + set_account_activity_img, + set_forwarding_address_img, + set_alias_address_img, + set_assigned_groups_img, + set_user_admin_type_img, + highlight_username_in_mail, + display_progress_bar, + display_filter_by_first_char, + show_pages, + display_remove_mailbox_days + with context + %} + +{% from "macros/msg_handlers.html" import user_msg_handler with context %} + +{% block title %}{{ _('Mail Users') }}{% endblock %} +{% block navlinks_domains %}class="active"{% endblock %} + +{% block breadcrumb %} + {% if all_are_admins %} + {% 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')), + ('active', ctx.homepath + '/admins/' + cur_domain, _('Admins')), + ] + %} + {% else %} + {% set crumbs = [ + (ctx.homepath + '/domains', _('All domains')), + (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain), + ('active', ctx.homepath + '/users/' + cur_domain, _('Users')), + (ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), + (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), + ] %} + + {% if session.get('is_global_admin') %} + {% set crumbs = crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} + {% endif %} + {% endif %} + + {% 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 #} +{{ user_msg_handler(msg) }} + +{% if users is defined %} + + {% if users or (not users and first_char) %} + {% if all_are_admins %} + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/admins/' + cur_domain, + first_char=first_char, + account_type='admin', + disabled_only=disabled_only) }} + {% else %} + {{ display_filter_by_first_char(baseurl=ctx.homepath + '/users/' + cur_domain, + available_chars=all_first_chars, + first_char=first_char, + account_type='user', + disabled_only=disabled_only) }} + {% endif %} + {% endif %} + + {# List all users. #} +
    +
    +
    + + +

    + {% if all_are_admins %} + {{ _('Admins under domain: %s') |format(cur_domain) }} + {% else %} + {{ _('Users under domain: %s') |format(cur_domain) }} + {% endif %} + + {% if total is defined and users|length > 0 %} + ({{ (cur_page-1) * page_size_limit + 1 }}-{{ (cur_page-1) * page_size_limit + users|length}}/{{ total }}) + {% endif %} + + + {{ set_account_activity_img('sent', 'domain', cur_domain, float=false) }} +

    +
    + +
    +
    +
    + + {# Control whether we should redirect to /admins/[domain] or /usrs/[domain] #} + {% if all_are_admins %} + + {% endif %} + + {{ input_csrf_token() }} + + + + + + + + {# + + #} + {% if all_are_admins %} + + {% else %} + + {% endif %} + + {% if last_logins %} + + {% endif %} + + + + + {% if users %} + {% for r in users %} + {% set mail = r.username |e %} + + + + + + + + {# mail quota #} + {% set usedQuotaBytes = used_quotas.get(mail, {}).get('bytes', 0) %} + {% set usedQuotaMessages = used_quotas.get(mail, {}).get('messages', 0) %} + {% if r.quota == 0 %} + {% if session.get('show_used_quota') %} + + {% else %} + + {% endif %} + {% else %} + {% set percent = usedQuotaBytes |convert_to_percentage(r.quota |int * 1024 * 1024) %} + + {% endif %} + + {% if last_logins %} + {% if mail in last_logins %} + {% set _times = last_logins.get(mail, {}) %} + + {% set _imap = _times.get('imap') or 0 %} + {% set _pop3 = _times.get('pop3') or 0 %} + {% set _lda = _times.get('lda') or 0 %} + + {# imap or pop3 login time #} + {% set _login_time = 0 %} + {% set _login_service = None %} + + {% if (_imap > 0) and (_pop3 > 0) %} + {% if _imap > _pop3 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% else %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + {% elif _imap > 0 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% elif _pop3 > 0 %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + + + {% else %} + + {% endif %} + {% endif %} + + {% endfor %} + {% else %} + + + + {% if all_are_admins %} + + {% else %} + + {% endif %} + + {% endif %} + +
    {{ _('Display Name') }}{{ _('Mail Address') }}{{ _('User/Employee ID') }}{{ _('Job Title') }}{{ _('Quota') }}{{ _('Quota') }} + {{ _('Last Login') }} + {% if backend != "pgsql" %} + ({{ _("All users") }}) + {% endif %} +
    + + + + + + {{ set_account_activity_img('sent', 'user', mail) }} + {{ set_account_status_img(r.active) }} + + {% if r.isglobaladmin %} + {{ set_user_admin_type_img('globaladmin') }} + {% elif r.isadmin %} + {{ set_user_admin_type_img('domainadmin') }} + {% endif %} + + {{ set_assigned_groups_img(addresses=user_assigned_groups.get(mail, [])) }} + {{ set_forwarding_address_img(user=mail, addresses=user_forwardings.get(mail, [])) }} + {{ set_alias_address_img(addresses=user_alias_addresses.get(mail, [])) }} + + {% if r.name %}{{ r.name |cut_string |e }}{% else %}{{ mail.split('@', 1)[0] }}{% endif %} + {{ highlight_username_in_mail(mail) }}{% if r.employeeid %}{{ r.employeeid |e }}{% endif %}{{ usedQuotaBytes |file_size_format }} / {{ _('Unlimited') }}{{ _('Unlimited') }} +
    + {{ percent }}% + ({{ usedQuotaMessages }} {{_('Emails') }} / {{ usedQuotaBytes |file_size_format }}) / {{ r.quota |file_size_format(base_mb=True) }} +
    + {{ display_progress_bar(percent, show_zero=true, width='60%', style='thin') }} +
    + {% if _login_time %} + + {{ _login_time | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }} + + {% if _login_service %} + {{ _login_service | upper }} + {% endif %} + + {% endif %} +
    {{ _('No mail admin assigned.') }}{{ _('No mail user available.') }} + {% if not (first_char or disabled_only) %} + {{ _('Add one') }}? + {% endif %} +
    + + + + {% if users %} + + {% endif %} +
    + +
    {# #user_list #} +
    {# .box-wrapper #} +
    {# -- End id=user_list -- #} +
    +{% endif %} +{% endblock main %} diff --git a/templates/default/sql/user/profile.html b/templates/default/sql/user/profile.html new file mode 100644 index 0000000..d702f53 --- /dev/null +++ b/templates/default/sql/user/profile.html @@ -0,0 +1,606 @@ +{% extends "layout.html" %} + +{% from "macros/form_inputs.html" import + input_submit, + input_csrf_token + with context + %} + +{% from "macros/general.html" import + display_subnav, + set_account_activity_img, + display_input_cn, + display_preferred_language, + display_timezones, + display_quota, + display_change_email_address, + display_input_employeeid, + display_account_status, + display_mark_user_as_admin, + display_reset_password, + display_random_password, + display_user_forwarding, + display_recipient_bcc, + display_sender_bcc, + display_relay, + display_sender_relayhost, + display_per_account_wblist_all, + display_allow_nets + with context + %} + +{% from "macros/sql.html" import + display_enabled_user_services, + display_all_domains + with context + %} + +{% from "macros/iredapd.html" import + display_throttle_setting, + display_greylisting_setting, + display_greylisting_whitelists + with context + %} + +{% from "macros/amavisd.html" import display_spam_policy with context %} +{% from "macros/msg_handlers.html" import warning_info, user_msg_handler with context %} + +{% block title %}{{ _('Edit account profile') }}{% endblock %} +{% block navlinks_domains %}class="active"{% endblock %} + +{% block breadcrumb %} + {% set tmp_crumbs = [ + (ctx.homepath + '/domains', _('All domains')), + (ctx.homepath + '/profile/domain/general/' + cur_domain, cur_domain), + (ctx.homepath + '/users/' + cur_domain, _('Users')), + ('active', ctx.homepath + '/profile/user/general/' + mail, _('Profile of user:') + ' ' + mail), + (ctx.homepath + '/mls/' + cur_domain, _('Mailing Lists')), + (ctx.homepath + '/aliases/' + cur_domain, _('Aliases')), + ] %} + + {% if session.get('is_global_admin') %} + {% set crumbs = tmp_crumbs + [(ctx.homepath + '/admins/' + cur_domain, _('Admins'))] %} + {% else %} + {% set crumbs = tmp_crumbs %} + {% endif %} + + {% 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 %} + +{% if discarded_aliases %} + {% set _msg = _('Some addresses have been discarded because they have been used: %s.') |format(discarded_aliases | join(', ')) %} + {{ warning_info(msg=_msg, removable=true) }} +{% endif %} + +{% if session.get('is_global_admin') %} + {% set navlinks = [ + ('general', _('General'), [true]), + ('forwarding', _('Forwarding'), [true]), + ('bcc', _('BCC'), [true]), + ('relay', _('Relay'), [true]), + ('aliases', _('Aliases'), [true]), + ('throttle', _('Throttling'), [session.get('iredapd_enabled')]), + ('greylisting', _('Greylisting'), [session.get('iredapd_enabled')]), + ('wblist', _('White/Blacklists'), [session.get('amavisd_enable_policy_lookup')]), + ('spampolicy', _('Spam Policy'), [session.get('amavisd_enable_policy_lookup')]), + ('password', _('Password'), [true]), + ('advanced', _('Advanced'), [true]), + ] + %} +{% else %} + {% set navlinks = [ + ('general', _('General'), [true]), + ('forwarding', _('Forwarding'), ['forwarding' not in disabled_user_profiles]), + ('bcc', _('BCC'), ['bcc' not in disabled_user_profiles]), + ('relay', _('Relay'), ['relay' not in disabled_user_profiles]), + ('aliases', _('Aliases'), ['aliases' not in disabled_user_profiles]), + ('throttle', _('Throttling'), ['throttle' not in disabled_user_profiles, session.get('iredapd_enabled')]), + ('greylisting', _('Greylisting'), ['greylisting' not in disabled_user_profiles, session.get('iredapd_enabled')]), + ('wblist', _('White/Blacklists'), [session.get('amavisd_enable_policy_lookup'), 'wblist' not in disabled_user_profiles]), + ('spampolicy', _('Spam Policy'), [session.get('amavisd_enable_policy_lookup'), 'spampolicy' not in disabled_user_profiles]), + ('password', _('Password'), [true]), + ('advanced', _('Advanced'), [true]), + ] + %} +{% endif %} + +
    +
    +
    +
      + {% for nav in navlinks %} + {% if not false in nav[2] and not none in nav[2] %} +
    • {{ nav[1] }}
    • + {% endif %} + {% endfor %} +
    + +

    {{ set_account_activity_img('sent', 'user', mail, float=false) }}

    +
    + + {# modal window used to change email address #} + {{ display_change_email_address(current_domain=cur_domain, + post_url=ctx.homepath + '/profile/user/rename/' + mail ) }} + +
    +
    +
    + {{ input_csrf_token() }} + + {# imap or pop3 login time #} + {% set _login_time = 0 %} + {% set _login_service = None %} + + {% set _times = last_logins.get(mail, {}) %} + + {# values may be None, so we use `or 0` to set it to `0` #} + {% set _imap = _times.get('imap', 0) or 0 %} + {% set _pop3 = _times.get('pop3', 0) or 0 %} + {% set _lda = _times.get('lda', 0) or 0 %} + + {% if (_imap > 0) and (_pop3 > 0) %} + {% if _imap > _pop3 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% else %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + {% elif _imap > 0 %} + {% set _login_time = _imap %} + {% set _login_service = 'imap' %} + {% elif _pop3 > 0 %} + {% set _login_time = _pop3 %} + {% set _login_service = 'pop3' %} + {% endif %} + +
    +
    + {{ display_account_status(profile.active, + last_login_epoch_seconds=_login_time, + last_login_service=_login_service) }} + +
    + {{ display_input_cn(value=profile.name, email=mail, empty_if_equal_to_username=true) }} + + {% set stored_mailbox_size = used_quota.get(mail, {}).get('bytes', 0) %} + {% set stored_mailbox_messages = used_quota.get(mail, {}).get('messages', 0) %} + + {{ display_quota(value=profile.quota, + show_value_in_input=true, + used_quota=stored_mailbox_size, + stored_messages=stored_mailbox_messages, + show_used_quota=true) }} + + {{ display_preferred_language(value=profile.get('language'), languagemaps=languagemaps) }} + {{ display_timezones(value=user_settings.get('timezone'), timezones=timezones) }} +
    + {{ display_input_employeeid(profile.employeeid) }} +
    {#-- .col2-3 --#} + +
    + {% if _login_time or _lda %} +
    +
      + {% if _imap %} +
    • {{ _('IMAP Login:') }} {{ _imap | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }}
    • + {% endif %} + {% if _pop3 %} +
    • {{ _('POP3 Login:') }} {{ _pop3 | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }}
    • + {% endif %} + {% if _lda %} +
    • {{ _('New Mail Delivered:') }} {{ _lda | epoch_seconds_to_gmt | utc_to_timezone(timezone=session.get('timezone')) }}
    • + {% endif %} +
    +
    + {% endif %} + +
    +
      +
    • {{ _('Change email address') }}
    • +
    • {{ _('You can enable self-service (per-domain setting) to allow users to manage their own preferences and more.') }}
    • +
    +
    +
    {# .col1-3 #} +
    {#-- .columns --#} + +
    +
    +
    +
    +

    {{ _('Member of Mailing Lists') }}

    +
    +
    + {% for ml_profile in all_maillist_profiles %} + {% set ml_mail = ml_profile.address |e %} + {% set ml_name = ml_profile.name |e %} + +
    + + + + +
    +
    + {% endfor %} +
    +
    {#-- .checklist --#} +
    {#-- form-field --#} +
    {#-- End col2-3 -- #} + + {# .col1-3 #} +
    {#-- .columns --#} + +
    +
    +
    +
    +

    {{ _('Member of Mail Aliases') }}

    +
    +
    + {% for _profile in all_aliases %} + {% set _name = _profile.name |e %} + {% set _mail = _profile.address |e %} + +
    + + + + +
    +
    + {% endfor %} + + {# Display assigned aliases which is not in same domain as current user #} + {% for _mail in assigned_aliases %} + {% if not _mail.endswith('@' + cur_domain) %} +
    + + + + +
    +
    + {% endif %} + {% endfor %} + +
    +
    {#-- .checklist --#} +
    {#-- form-field --#} +
    {#-- End col2-3 -- #} + + {# .col1-3 #} +
    {#-- .columns --#} + + {% if session.get('is_global_admin') or session.get('allowed_to_grant_admin') %} +
    +
    +
    + {{ display_mark_user_as_admin(is_domain_admin=profile.get('isadmin', 0), + is_global_admin=profile.get('isglobaladmin', 0), + allowed_to_grant_admin=user_settings.get('grant_admin', 'no'), + user_settings=user_settings) }} +
    + + {% if session.get('is_global_admin') %} +
    +
    +
      +
    • {{ _('All domains managed by this admin share the mailbox quota and limit of mail accounts.') }}
    • +
    • {{ _('Domain ownership verification is recommended if you can not fully trust this admin, because if domains like gmail.com, hotmail.com were added locally, all emails sent to gmail.com/hotmail.com will be delivered locally on your server instead of the real Gmail/Hotmail servers.') }}
    • +
    +
    +
    {# .col1-3 #} + {% endif %} +
    + + {{ display_all_domains(managedDomains=managed_domains, allDomains=all_domains) }} + + {% endif %} + + {{ input_submit() }} +
    +
    {# #profile_general #} + + {# profile_type == 'forwarding' #} + {% if session.get('is_global_admin') or 'forwarding' not in disabled_user_profiles %} +
    +
    + {{ input_csrf_token() }} + + {{ display_user_forwarding(mail=mail, + enabled=none, + forwarding_addresses=profile.forwardings) }} + + {{ input_submit() }} +
    +
    {# #profile_forwarding #} + {% endif %} + + {# profile_type: bcc #} + {% if session.get('is_global_admin') or 'bcc' not in disabled_user_profiles %} +
    +
    + {{ input_csrf_token() }} + {# BCC #} +
    +
    +
    +

    {{ _('Monitor incoming emails via BCC') }}

    +
    + +
    +
    + +
    +

    {{ _('Monitor outgoing emails via BCC') }}

    +
    + +
    +
    + + {{ display_recipient_bcc(address=profile.recipient_bcc_address) }} + {{ display_sender_bcc(address=profile.sender_bcc_address) }} +
    + +
    +
    +
      +
    • {{ _('Multiple addresses are NOT supported.') }}
    • +
    • {{ _('Per-user bcc settings has higher priority than per-domain bcc settings.') }}
    • +
    • {{ _('Invalid email addresses will be silently discarded.') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    + + {{ input_submit() }} +
    +
    + {% endif %} + + {# Relay #} + {% if session.get('is_global_admin') or 'relay' not in disabled_user_profiles %} +
    +
    + {{ input_csrf_token() }} + {{ display_relay(profile.transport |default('') |e, + account_type='user', + url=ctx.homepath + '/profile/domain/relay/' + cur_domain) }} + +
    + {{ display_sender_relayhost(relayhost=relayhost) }} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# Aliases #} + {% if session.get('is_global_admin') or 'aliases' not in disabled_user_profiles %} +
    +
    + {{ input_csrf_token() }} + +
    +
    +
    +

    {{ _('Email addresses of alias accounts') }}

    + {{ _('One mail address per line. Invalid address will be discarded.') }} +
    + +
    +

    + +
    +
    {#-- .col2-3 --#} + +
    +
    +
      +
    • {{ _('Emails sent to alias addresses will be delivered to %s.') |format('' + mail + '') }}
    • + {% if user_alias_cross_all_domains is sameas false %} +
    • {{ _('Email address of alias account must end with domain name(s): %s.') |format('' + cur_domain + '') }}
    • + {% endif %} +
    +
    +
    +
    {#-- .columns --#} + {{ input_submit() }} +
    +
    + {% endif %} + + + {# Throttling #} + {% if session.get('iredapd_enabled') and (session.get('is_global_admin') or ('throttle' not in disabled_user_profiles)) %} +
    +
    + {{ input_csrf_token() }} + + {# Throttling in iRedAPD#} +
    + {{ display_throttle_setting(account=mail, + setting=outbound_throttle_setting, + inout_type='outbound') }} + + {{ display_throttle_setting(account=mail, + setting=inbound_throttle_setting, + inout_type='inbound', + with_left_border=true) }} + +
    +
    +
      +
    • {{ _('You can set per-domain throttling in domain profile page.') }}
    • +
    +
    +
    {#-- .col1-3 --#} +
    {# .columns #} + + {{ input_submit() }} +
    +
    {# #profile_throttle #} + {% endif %} + + {# profile_type: greylisting, with iRedAPD #} + {% if 'greylisting' not in disabled_user_profiles %} + {% if session.get('iredapd_enabled') %} +
    +
    + {{ input_csrf_token() }} + + {{ display_greylisting_setting(account=mail, gl_setting=gl_setting) }} + {{ display_greylisting_whitelists(account=mail, gl_whitelists=gl_whitelists) }} + + {{ input_submit() }} +
    +
    + {% endif %} + {% endif %} + + {# wblist #} + {% if session.get('amavisd_enable_policy_lookup') and (session.get('is_global_admin') or ('wblist' not in disabled_user_profiles)) %} +
    +
    + {{ input_csrf_token() }} + + {{ display_per_account_wblist_all(inbound_whitelists=whitelists, + inbound_blacklists=blacklists, + outbound_whitelists=outbound_whitelists, + outbound_blacklists=outbound_blacklists) }} + + {{ input_submit() }} +
    +
    + {% endif %} + + {# Spam Policy#} + {% if session.get('amavisd_enable_policy_lookup') and (session.get('is_global_admin') or ('spampolicy' not in disabled_user_profiles)) %} +
    +
    + {{ input_csrf_token() }} + +
    + {{ display_spam_policy(account_type='user', + spampolicy=spampolicy, + custom_ban_rules=custom_ban_rules, + global_spam_score=global_spam_score) }} + {{ input_submit() }} +
    +
    +
    + {% endif %} + + {# Password #} +
    +
    + {{ input_csrf_token() }} +
    +
    + {{ display_reset_password(show_confirmpw=true, + min_passwd_length=min_passwd_length, + max_passwd_length=max_passwd_length, + store_password_in_plain_text=store_password_in_plain_text) }} +
    +
    + {{ display_random_password(password_length=min_passwd_length, + password_policies=password_policies, + password_last_change_date=profile.passwordlastchange) }} +
    +
    + + {{ input_submit() }} +
    +
    + +
    +
    + {{ input_csrf_token() }} + + {{ display_enabled_user_services(profile=profile, greylisted=greylisted) }} + +
    + {{ display_allow_nets(allow_nets=allow_nets) }} +
    + + {% if session.get('is_global_admin') %} + {# Maildir path #} +
    +

    {{ _('Path to mailbox') }}

    + + / + + / + +
    + {% endif %} + + {{ input_submit() }} +
    +
    +
    +
    +
    +{% endblock main %} + +{% block extra_js %} + +{% endblock extra_js %}