diff --git a/core/admin/Dockerfile b/core/admin/Dockerfile index 2406bb5c..a7ca45c7 100644 --- a/core/admin/Dockerfile +++ b/core/admin/Dockerfile @@ -1,7 +1,8 @@ # First stage to build assets ARG DISTRO=alpine:3.14 ARG ARCH="" -FROM ${ARCH}node:8 as assets + +FROM ${ARCH}node:16 as assets COPY --from=balenalib/rpi-alpine:3.14 /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static COPY package.json ./ diff --git a/core/admin/assets/app.css b/core/admin/assets/app.css index e1656429..8351eed8 100644 --- a/core/admin/assets/app.css +++ b/core/admin/assets/app.css @@ -20,3 +20,4 @@ .sidebar-toggle { padding: unset !important; } + diff --git a/core/admin/assets/app.js b/core/admin/assets/app.js index dc981081..364f8429 100644 --- a/core/admin/assets/app.js +++ b/core/admin/assets/app.js @@ -1,10 +1,17 @@ require('./app.css'); -import 'select2'; +import 'admin-lte/plugins/select2/js/select2.js'; +import 'admin-lte/plugins/datatables/jquery.dataTables.js'; +import 'admin-lte/plugins/datatables-bs4/js/dataTables.bootstrap4.js'; +import 'admin-lte/plugins/datatables-responsive/js/dataTables.responsive.js'; +import 'admin-lte/plugins/datatables-responsive/js/responsive.bootstrap4.js'; + jQuery("document").ready(function() { jQuery(".mailselect").select2({ tags: true, tokenSeparators: [',', ' '] - }) + }); + jQuery(".dataTable").DataTable({ + "responsive": true, + }); }); - diff --git a/core/admin/assets/vendor.js b/core/admin/assets/vendor.js index f7ed03c8..fd43d918 100644 --- a/core/admin/assets/vendor.js +++ b/core/admin/assets/vendor.js @@ -1,19 +1,22 @@ // jQuery import jQuery from 'jquery'; -import 'select2/dist/css/select2.css'; +import 'admin-lte/plugins/select2/css/select2.css'; // bootstrap -import 'bootstrap/less/bootstrap.less'; -import 'bootstrap'; +// import 'bootstrap/less/bootstrap.less'; +// import 'bootstrap'; -// FA -import 'font-awesome/scss/font-awesome.scss'; +// FontAwesome +import 'admin-lte/plugins/fontawesome-free/css/fontawesome.css'; +import 'admin-lte/plugins/fontawesome-free/css/regular.css'; +import 'admin-lte/plugins/fontawesome-free/css/solid.css'; // AdminLTE -import 'admin-lte/build/less/AdminLTE-without-plugins.less'; -import 'admin-lte/build/less/select2.less'; -import 'admin-lte/build/less/skins/skin-blue.less'; +import 'admin-lte/build/scss/adminlte.scss'; +import 'admin-lte/plugins/datatables-bs4/css/dataTables.bootstrap4.css'; +import 'admin-lte/plugins/datatables-responsive/css/responsive.bootstrap4.css'; +import 'admin-lte/plugins/bootstrap/js/bootstrap.js'; +import 'admin-lte/build/js/AdminLTE.js'; import 'admin-lte/build/js/Layout.js'; import 'admin-lte/build/js/ControlSidebar.js'; import 'admin-lte/build/js/PushMenu.js'; -import 'admin-lte/build/js/BoxRefresh.js'; diff --git a/core/admin/mailu/ui/templates/admin/create.html b/core/admin/mailu/ui/templates/admin/create.html index 8d3a7b58..6c2413bc 100644 --- a/core/admin/mailu/ui/templates/admin/create.html +++ b/core/admin/mailu/ui/templates/admin/create.html @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %}
{{ form.hidden_tag() }} {{ macros.form_field(form.admin, class_='mailselect') }} diff --git a/core/admin/mailu/ui/templates/admin/list.html b/core/admin/mailu/ui/templates/admin/list.html index 72b5a1fa..f2f5d229 100644 --- a/core/admin/mailu/ui/templates/admin/list.html +++ b/core/admin/mailu/ui/templates/admin/list.html @@ -5,24 +5,28 @@ {% endblock %} {% block main_action %} - + {% trans %}Add administrator{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Email{% endtrans %} - -{% for admin in admins %} - - - - - {{ admin }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Email{% endtrans %} + + + + {% for admin in admins %} + + + + + {{ admin }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/alias/create.html b/core/admin/mailu/ui/templates/alias/create.html index 38d7e7e5..2079d191 100644 --- a/core/admin/mailu/ui/templates/alias/create.html +++ b/core/admin/mailu/ui/templates/alias/create.html @@ -9,10 +9,10 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ form.hidden_tag() }} - {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} + {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} {{ macros.form_field(form.wildcard) }} {{ macros.form_field(form.destination, class_='mailselect') }} {{ macros.form_field(form.comment) }} diff --git a/core/admin/mailu/ui/templates/alias/list.html b/core/admin/mailu/ui/templates/alias/list.html index 29766b25..e8ddc862 100644 --- a/core/admin/mailu/ui/templates/alias/list.html +++ b/core/admin/mailu/ui/templates/alias/list.html @@ -9,31 +9,35 @@ {% endblock %} {% block main_action %} -{% trans %}Add alias{% endtrans %} +{% trans %}Add alias{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Email{% endtrans %} - {% trans %}Destination{% endtrans %} - {% trans %}Comment{% endtrans %} - {% trans %}Created{% endtrans %} - {% trans %}Last edit{% endtrans %} - -{% for alias in domain.aliases %} - - -   - - - {{ alias }} - {{ alias.destination|join(', ') or '-' }} - {{ alias.comment or '' }} - {{ alias.created_at }} - {{ alias.updated_at or '' }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Email{% endtrans %} + {% trans %}Destination{% endtrans %} + {% trans %}Comment{% endtrans %} + {% trans %}Created{% endtrans %} + {% trans %}Last edit{% endtrans %} + + + + {% for alias in domain.aliases %} + + +   + + + {{ alias }} + {{ alias.destination|join(', ') or '-' }} + {{ alias.comment or '' }} + {{ alias.created_at }} + {{ alias.updated_at or '' }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/alternative/list.html b/core/admin/mailu/ui/templates/alternative/list.html index 56e7565b..f123eb9f 100644 --- a/core/admin/mailu/ui/templates/alternative/list.html +++ b/core/admin/mailu/ui/templates/alternative/list.html @@ -9,24 +9,28 @@ {% endblock %} {% block main_action %} -{% trans %}Add alternative{% endtrans %} +{% trans %}Add alternative{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Name{% endtrans %} - {% trans %}Created{% endtrans %} - -{% for alternative in domain.alternatives %} - - - - - {{ alternative }} - {{ alternative.created_at }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Name{% endtrans %} + {% trans %}Created{% endtrans %} + + + + {% for alternative in domain.alternatives %} + + + + + {{ alternative }} + {{ alternative.created_at }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/announcement.html b/core/admin/mailu/ui/templates/announcement.html index 7dd34d3f..acdbde1a 100644 --- a/core/admin/mailu/ui/templates/announcement.html +++ b/core/admin/mailu/ui/templates/announcement.html @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ form.hidden_tag() }} {{ macros.form_field(form.announcement_subject) }} diff --git a/core/admin/mailu/ui/templates/base.html b/core/admin/mailu/ui/templates/base.html index 74d5653c..89695e50 100644 --- a/core/admin/mailu/ui/templates/base.html +++ b/core/admin/mailu/ui/templates/base.html @@ -8,44 +8,58 @@ Mailu-Admin - {{ config["SITENAME"] }} - +
-
- -
-
diff --git a/core/admin/mailu/ui/templates/client.html b/core/admin/mailu/ui/templates/client.html index 81bee135..668621af 100644 --- a/core/admin/mailu/ui/templates/client.html +++ b/core/admin/mailu/ui/templates/client.html @@ -1,3 +1,5 @@ + + {% extends "base.html" %} {% block title %} @@ -9,8 +11,7 @@ configure your email client {% endblock %} {% block content %} -{% call macros.box(title="Incoming mail") %} - +{% call macros.table(title="Incoming mail", datatable=False) %} @@ -33,11 +34,9 @@ configure your email client -
{% trans %}Mail protocol{% endtrans %}
*******
{% endcall %} -{% call macros.box(title="Outgoing mail") %} - +{% call macros.table(title="Outgoing mail", datatable=False) %} @@ -60,6 +59,5 @@ configure your email client -
{% trans %}Mail protocol{% endtrans %}
*******
{% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/confirm.html b/core/admin/mailu/ui/templates/confirm.html index 3b8a451f..d0f6acf3 100644 --- a/core/admin/mailu/ui/templates/confirm.html +++ b/core/admin/mailu/ui/templates/confirm.html @@ -9,7 +9,7 @@ {% endblock %} {% block content %} -{% call macros.box(theme="warning") %} +{% call macros.card(theme="warning") %}

{% trans action %}You are about to {{ action }}. Please confirm your action.{% endtrans %}

{{ macros.form(form) }} {% endcall %} diff --git a/core/admin/mailu/ui/templates/domain/create.html b/core/admin/mailu/ui/templates/domain/create.html index d67e3e89..3fdd262a 100644 --- a/core/admin/mailu/ui/templates/domain/create.html +++ b/core/admin/mailu/ui/templates/domain/create.html @@ -5,13 +5,13 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ form.hidden_tag() }} {{ macros.form_field(form.name) }} {{ macros.form_fields((form.max_users, form.max_aliases)) }} {{ macros.form_field(form.max_quota_bytes, step=1000000000, max=50000000000, - prepend=''+((form.max_quota_bytes.data//1000000000).__str__() if form.max_quota_bytes.data else '∞')+' GiB', + prepend=''+((form.max_quota_bytes.data//1000000000).__str__() if form.max_quota_bytes.data else '∞')+' GiB', oninput='$("#quota").text(this.value == 0 ? "∞" : this.value/1000000000);') }} {{ macros.form_field(form.signup_enabled) }} {{ macros.form_field(form.comment) }} diff --git a/core/admin/mailu/ui/templates/domain/details.html b/core/admin/mailu/ui/templates/domain/details.html index 5822ffbc..0560d5e0 100644 --- a/core/admin/mailu/ui/templates/domain/details.html +++ b/core/admin/mailu/ui/templates/domain/details.html @@ -10,7 +10,7 @@ {% block main_action %} {% if current_user.global_admin %} - + {% if domain.dkim_publickey %} {% trans %}Regenerate keys{% endtrans %} {% else %} @@ -21,7 +21,7 @@ {% endblock %} {% block content %} -{% call macros.table() %} +{% call macros.table(datatable=False) %} {% set hostname = config["HOSTNAMES"].split(",")[0] %} {% trans %}Domain name{% endtrans %} diff --git a/core/admin/mailu/ui/templates/domain/list.html b/core/admin/mailu/ui/templates/domain/list.html index 2431faa5..c82647df 100644 --- a/core/admin/mailu/ui/templates/domain/list.html +++ b/core/admin/mailu/ui/templates/domain/list.html @@ -6,46 +6,50 @@ {% block main_action %} {% if current_user.global_admin %} -{% trans %}New domain{% endtrans %} +{% trans %}New domain{% endtrans %} {% endif %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Manage{% endtrans %} - {% trans %}Domain name{% endtrans %} - {% trans %}Mailbox count{% endtrans %} - {% trans %}Alias count{% endtrans %} - {% trans %}Comment{% endtrans %} - {% trans %}Created{% endtrans %} - {% trans %}Last edit{% endtrans %} - -{% for domain in current_user.get_managed_domains() %} - - -   - {% if current_user.global_admin %} -   -   - {% endif %} - - -   -   -   - {% if current_user.global_admin %} -   - {% endif %} - - {{ domain.name }} - {{ domain.users | count }} / {{ '∞' if domain.max_users == -1 else domain.max_users }} - {{ domain.aliases | count }} / {{ '∞' if domain.max_aliases == -1 else domain.max_aliases }} - {{ domain.comment or '' }} - {{ domain.created_at }} - {{ domain.updated_at or '' }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Manage{% endtrans %} + {% trans %}Domain name{% endtrans %} + {% trans %}Mailbox count{% endtrans %} + {% trans %}Alias count{% endtrans %} + {% trans %}Comment{% endtrans %} + {% trans %}Created{% endtrans %} + {% trans %}Last edit{% endtrans %} + + + + {% for domain in current_user.get_managed_domains() %} + + +   + {% if current_user.global_admin %} +   +   + {% endif %} + + +   +   +   + {% if current_user.global_admin %} +   + {% endif %} + + {{ domain.name }} + {{ domain.users | count }} / {{ '∞' if domain.max_users == -1 else domain.max_users }} + {{ domain.aliases | count }} / {{ '∞' if domain.max_aliases == -1 else domain.max_aliases }} + {{ domain.comment or '' }} + {{ domain.created_at }} + {{ domain.updated_at or '' }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/domain/signup.html b/core/admin/mailu/ui/templates/domain/signup.html index c8a52f6c..e9dbd75f 100644 --- a/core/admin/mailu/ui/templates/domain/signup.html +++ b/core/admin/mailu/ui/templates/domain/signup.html @@ -9,7 +9,7 @@ {{ form.hidden_tag() }} - {% call macros.box(title="Requirements") %} + {% call macros.card(title="Requirements") %}

{% trans %}In order to register a new domain, you must first setup the domain zone so that the domain MX points to this server{% endtrans %} ({{ config["HOSTNAMES"].split(",")[0] }}). @@ -22,9 +22,9 @@

{% endcall %} - {% call macros.box() %} + {% call macros.card() %} {% if form.localpart %} - {{ macros.form_fields((form.localpart, form.name), append='@') }} + {{ macros.form_fields((form.localpart, form.name), append='@') }} {{ macros.form_fields((form.pw, form.pw2)) }} {% else %} {{ macros.form_field(form.name) }} diff --git a/core/admin/mailu/ui/templates/fetch/create.html b/core/admin/mailu/ui/templates/fetch/create.html index bc69fc44..1b5bc194 100644 --- a/core/admin/mailu/ui/templates/fetch/create.html +++ b/core/admin/mailu/ui/templates/fetch/create.html @@ -11,18 +11,18 @@ {% block content %} {{ form.hidden_tag() }} - {% call macros.box(title="Remote server") %} + {% call macros.card(title="Remote server") %} {{ macros.form_field(form.protocol) }} {{ macros.form_fields((form.host, form.port)) }} {{ macros.form_field(form.tls) }} {% endcall %} - {% call macros.box(title="Authentication") %} + {% call macros.card(title="Authentication") %} {{ macros.form_field(form.username) }} {{ macros.form_field(form.password) }} {% endcall %} - {% call macros.box(title="Settings") %} + {% call macros.card(title="Settings") %} {{ macros.form_field(form.keep) }} {% endcall %} diff --git a/core/admin/mailu/ui/templates/fetch/list.html b/core/admin/mailu/ui/templates/fetch/list.html index 07ab5ad8..77f66bb1 100644 --- a/core/admin/mailu/ui/templates/fetch/list.html +++ b/core/admin/mailu/ui/templates/fetch/list.html @@ -9,35 +9,39 @@ {% endblock %} {% block main_action %} -{% trans %}Add an account{% endtrans %} +{% trans %}Add an account{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Endpoint{% endtrans %} - {% trans %}Username{% endtrans %} - {% trans %}Keep emails{% endtrans %} - {% trans %}Last check{% endtrans %} - {% trans %}Status{% endtrans %} - {% trans %}Created{% endtrans %} - {% trans %}Last edit{% endtrans %} - -{% for fetch in user.fetches %} - - -   - - - {{ fetch.protocol }}{{ 's' if fetch.tls else '' }}://{{ fetch.host }}:{{ fetch.port }} - {{ fetch.username }} - {% if fetch.keep %}{% trans %}yes{% endtrans %}{% else %}{% trans %}no{% endtrans %}{% endif %} - {{ fetch.last_check or '-' }} - {{ fetch.error or '-' }} - {{ fetch.created_at }} - {{ fetch.updated_at or '' }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Endpoint{% endtrans %} + {% trans %}Username{% endtrans %} + {% trans %}Keep emails{% endtrans %} + {% trans %}Last check{% endtrans %} + {% trans %}Status{% endtrans %} + {% trans %}Created{% endtrans %} + {% trans %}Last edit{% endtrans %} + + + + {% for fetch in user.fetches %} + + +   + + + {{ fetch.protocol }}{{ 's' if fetch.tls else '' }}://{{ fetch.host }}:{{ fetch.port }} + {{ fetch.username }} + {% if fetch.keep %}{% trans %}yes{% endtrans %}{% else %}{% trans %}no{% endtrans %}{% endif %} + {{ fetch.last_check or '-' }} + {{ fetch.error or '-' }} + {{ fetch.created_at }} + {{ fetch.updated_at or '' }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/form.html b/core/admin/mailu/ui/templates/form.html index 25d7e83c..0e65ce33 100644 --- a/core/admin/mailu/ui/templates/form.html +++ b/core/admin/mailu/ui/templates/form.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ macros.form(form) }} {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/macros.html b/core/admin/mailu/ui/templates/macros.html index ec4cf6e4..d1715c7a 100644 --- a/core/admin/mailu/ui/templates/macros.html +++ b/core/admin/mailu/ui/templates/macros.html @@ -37,9 +37,10 @@ {{ field.label if label else '' }} {% else %} {{ field.label if label else '' }}{{ form_field_errors(field) }} - {% if prepend or append %}
{% endif %} - {{ prepend|safe }}{{ field(class_="form-control " + class_, **kwargs) }}{{ append|safe }} - {% if prepend or append %}
{% endif %} + {% if prepend %}
{% endif %} + {% if append %}
{% endif %} + {{ prepend|safe }}{{ field(class_="form-control " + class_, **kwargs) }}{{ append|safe }} + {% if prepend or append %}
{% endif %} {% endif %} {% endmacro %} @@ -64,18 +65,18 @@ {% endmacro %} -{% macro box(title=None, theme="primary", header=True) %} +{% macro card(title=None, theme="primary", header=True) %}
-
+
{% if header %} -
+
{% if title %} -

{{ title }}

+

{{ title }}

{% endif %}
{% endif %} -
+
{{ caller() }}
@@ -83,15 +84,20 @@
{% endmacro %} -{% macro table(theme="primary") %} +{% macro table(title=None, theme="primary", datatable=True) %}
-
- - +
+
+ {% if title %} +

{{ title }}

+ {% endif %} +
+
+
{{ caller() }} - -
+ +
diff --git a/core/admin/mailu/ui/templates/manager/create.html b/core/admin/mailu/ui/templates/manager/create.html index e3911642..bc5e6ca9 100644 --- a/core/admin/mailu/ui/templates/manager/create.html +++ b/core/admin/mailu/ui/templates/manager/create.html @@ -9,7 +9,7 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %}
{{ form.hidden_tag() }} {{ macros.form_field(form.manager, class_='mailselect') }} diff --git a/core/admin/mailu/ui/templates/manager/list.html b/core/admin/mailu/ui/templates/manager/list.html index d818a876..9a78e3ca 100644 --- a/core/admin/mailu/ui/templates/manager/list.html +++ b/core/admin/mailu/ui/templates/manager/list.html @@ -9,15 +9,18 @@ {% endblock %} {% block main_action %} -{% trans %}Add manager{% endtrans %} +{% trans %}Add manager{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Email{% endtrans %} - + + + {% trans %}Actions{% endtrans %} + {% trans %}Email{% endtrans %} + + + {% for manager in domain.managers %} @@ -26,5 +29,6 @@ {{ manager }} {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/relay/list.html b/core/admin/mailu/ui/templates/relay/list.html index bb00b1d9..6c8c9196 100644 --- a/core/admin/mailu/ui/templates/relay/list.html +++ b/core/admin/mailu/ui/templates/relay/list.html @@ -6,32 +6,36 @@ {% block main_action %} {% if current_user.global_admin %} -{% trans %}New relayed domain{% endtrans %} +{% trans %}New relayed domain{% endtrans %} {% endif %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Domain name{% endtrans %} - {% trans %}Remote host{% endtrans %} - {% trans %}Comment{% endtrans %} - {% trans %}Created{% endtrans %} - {% trans %}Last edit{% endtrans %} - -{% for relay in relays %} - - -  -   - - {{ relay.name }} - {{ relay.smtp or '-' }} - {{ relay.comment or '' }} - {{ relay.created_at }} - {{ relay.updated_at or '' }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Domain name{% endtrans %} + {% trans %}Remote host{% endtrans %} + {% trans %}Comment{% endtrans %} + {% trans %}Created{% endtrans %} + {% trans %}Last edit{% endtrans %} + + + + {% for relay in relays %} + + +   +   + + {{ relay.name }} + {{ relay.smtp or '-' }} + {{ relay.comment or '' }} + {{ relay.created_at }} + {{ relay.updated_at or '' }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/sidebar.html b/core/admin/mailu/ui/templates/sidebar.html index 78be75d5..0fdae9db 100644 --- a/core/admin/mailu/ui/templates/sidebar.html +++ b/core/admin/mailu/ui/templates/sidebar.html @@ -1,120 +1,144 @@ - + + {% if config["WEBMAIL"] != "none" %} + + {% endif %} + + + + {% if config['DOMAIN_REGISTRATION'] %} + + {% endif %} + {% if current_user.is_authenticated %} + + {% else %} + + {% if signup_domains %} + + {% endif %} + {% endif %} + + +
diff --git a/core/admin/mailu/ui/templates/token/list.html b/core/admin/mailu/ui/templates/token/list.html index ad560e6a..09d0fe76 100644 --- a/core/admin/mailu/ui/templates/token/list.html +++ b/core/admin/mailu/ui/templates/token/list.html @@ -9,26 +9,30 @@ {% endblock %} {% block main_action %} -{% trans %}New token{% endtrans %} +{% trans %}New token{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}Comment{% endtrans %} - {% trans %}Authorized IP{% endtrans %} - {% trans %}Created{% endtrans %} - -{% for token in user.tokens %} - - - - - {{ token.comment }} - {{ token.ip or "any" }} - {{ token.created_at }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}Comment{% endtrans %} + {% trans %}Authorized IP{% endtrans %} + {% trans %}Created{% endtrans %} + + + + {% for token in user.tokens %} + + + + + {{ token.comment }} + {{ token.ip or "any" }} + {{ token.created_at }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/user/create.html b/core/admin/mailu/ui/templates/user/create.html index ed7b9884..886cbb88 100644 --- a/core/admin/mailu/ui/templates/user/create.html +++ b/core/admin/mailu/ui/templates/user/create.html @@ -12,17 +12,17 @@ {{ form.hidden_tag() }} - {% call macros.box(_("General")) %} - {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} + {% call macros.card(_("General")) %} + {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} {{ macros.form_fields((form.pw, form.pw2)) }} {{ macros.form_field(form.displayed_name) }} {{ macros.form_field(form.comment) }} {{ macros.form_field(form.enabled) }} {% endcall %} - {% call macros.box(_("Features and quotas"), theme="success") %} + {% call macros.card(_("Features and quotas"), theme="success") %} {{ macros.form_field(form.quota_bytes, step=1000000000, max=(max_quota_bytes or domain.max_quota_bytes or 50000000000), - prepend=''+((form.quota_bytes.data//1000000000).__str__() if form.quota_bytes.data else '∞')+' GiB', + prepend=''+((form.quota_bytes.data//1000000000).__str__() if form.quota_bytes.data else '∞')+' GiB', oninput='$("#quota").text(this.value == 0 ? "∞" : this.value/1000000000);') }} {{ macros.form_field(form.enable_imap) }} {{ macros.form_field(form.enable_pop) }} diff --git a/core/admin/mailu/ui/templates/user/forward.html b/core/admin/mailu/ui/templates/user/forward.html index 769d439d..6059f0ed 100644 --- a/core/admin/mailu/ui/templates/user/forward.html +++ b/core/admin/mailu/ui/templates/user/forward.html @@ -9,7 +9,7 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ form.hidden_tag() }} {{ macros.form_field(form.forward_enabled, diff --git a/core/admin/mailu/ui/templates/user/list.html b/core/admin/mailu/ui/templates/user/list.html index 746afd45..cfec6276 100644 --- a/core/admin/mailu/ui/templates/user/list.html +++ b/core/admin/mailu/ui/templates/user/list.html @@ -9,45 +9,46 @@ {% endblock %} {% block main_action %} -{% trans %}Add user{% endtrans %} +{% trans %}Add user{% endtrans %} {% endblock %} {% block content %} {% call macros.table() %} - - {% trans %}Actions{% endtrans %} - {% trans %}User settings{% endtrans %} - {% trans %}Email{% endtrans %} - {% trans %}Features{% endtrans %} - {% trans %}Storage Quota{% endtrans %} - {% trans %}Sending Quota{% endtrans %} - {% trans %}Comment{% endtrans %} - {% trans %}Created{% endtrans %} - {% trans %}Last edit{% endtrans %} - -{% for user in domain.users %} - - -   - - - -   -   -   - - {{ user }} - - {% if user.enable_imap %}imap{% endif %} - {% if user.enable_pop %}pop3{% endif %} - - {{ user.quota_bytes_used | filesizeformat }} / {{ (user.quota_bytes | filesizeformat) if user.quota_bytes else '∞' }} - {% set limiter = user.sender_limiter %} - {{ limiter.get_window_stats()[1] }} / {{ limiter.limit }} - {{ user.comment or '-' }} - {{ user.created_at }} - {{ user.updated_at or '' }} - -{% endfor %} + + + {% trans %}Actions{% endtrans %} + {% trans %}User settings{% endtrans %} + {% trans %}Email{% endtrans %} + {% trans %}Features{% endtrans %} + {% trans %}Quota{% endtrans %} + {% trans %}Comment{% endtrans %} + {% trans %}Created{% endtrans %} + {% trans %}Last edit{% endtrans %} + + + + {% for user in domain.users %} + + +   + + + +   +   +   + + {{ user }} + + {% if user.enable_imap %}imap{% endif %} + {% if user.enable_pop %}pop3{% endif %} + + {{ user.quota_bytes_used | filesizeformat }} / {{ (user.quota_bytes | filesizeformat) if user.quota_bytes else '∞' }} + {{ user.comment or '-' }} + {{ user.created_at }} + {{ user.updated_at or '' }} + + {% endfor %} + {% endcall %} {% endblock %} diff --git a/core/admin/mailu/ui/templates/user/reply.html b/core/admin/mailu/ui/templates/user/reply.html index 1a161188..74c604fa 100644 --- a/core/admin/mailu/ui/templates/user/reply.html +++ b/core/admin/mailu/ui/templates/user/reply.html @@ -9,7 +9,7 @@ {% endblock %} {% block content %} -{% call macros.box() %} +{% call macros.card() %} {{ form.hidden_tag() }} {{ macros.form_field(form.reply_enabled, diff --git a/core/admin/mailu/ui/templates/user/settings.html b/core/admin/mailu/ui/templates/user/settings.html index b6ade695..9aa672ca 100644 --- a/core/admin/mailu/ui/templates/user/settings.html +++ b/core/admin/mailu/ui/templates/user/settings.html @@ -12,18 +12,18 @@ {{ form.hidden_tag() }} - {% call macros.box(title=_("Displayed name")) %} + {% call macros.card(title=_("Displayed name")) %} {{ macros.form_field(form.displayed_name) }} {% endcall %} - {% call macros.box(title=_("Antispam")) %} + {% call macros.card(title=_("Antispam")) %} {{ macros.form_field(form.spam_enabled) }} {{ macros.form_field(form.spam_threshold, step=1, max=100, - prepend=''+form.spam_threshold.data.__str__()+' / 100', + prepend=''+form.spam_threshold.data.__str__()+' / 100', oninput='$("#threshold").text(this.value);') }} {% endcall %} - {% call macros.box(title=_("Auto-forward")) %} + {% call macros.card(title=_("Auto-forward")) %} {{ macros.form_field(form.forward_enabled, onchange="if(this.checked){$('#forward_destination,#forward_keep').removeAttr('disabled')} else{$('#forward_destination,#forward_keep').attr('disabled', '')}") }} diff --git a/core/admin/mailu/ui/templates/user/signup.html b/core/admin/mailu/ui/templates/user/signup.html index f540d660..1157cfa3 100644 --- a/core/admin/mailu/ui/templates/user/signup.html +++ b/core/admin/mailu/ui/templates/user/signup.html @@ -11,8 +11,8 @@ {% block content %} {{ form.hidden_tag() }} - {% call macros.box() %} - {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} + {% call macros.card() %} + {{ macros.form_field(form.localpart, append='@'+domain.name+'') }} {{ macros.form_fields((form.pw, form.pw2)) }} {% if form.captcha %} {{ macros.form_field(form.captcha) }} diff --git a/core/admin/mailu/ui/views/__init__.py b/core/admin/mailu/ui/views/__init__.py index e7ae8b35..5488c82f 100644 --- a/core/admin/mailu/ui/views/__init__.py +++ b/core/admin/mailu/ui/views/__init__.py @@ -1,4 +1,4 @@ __all__ = [ 'admins', 'aliases', 'alternatives', 'base', 'domains', 'fetches', - 'managers', 'users', 'relays', 'tokens' + 'managers', 'users', 'relays', 'tokens', 'languages' ] diff --git a/core/admin/mailu/ui/views/languages.py b/core/admin/mailu/ui/views/languages.py new file mode 100644 index 00000000..9fb87d5c --- /dev/null +++ b/core/admin/mailu/ui/views/languages.py @@ -0,0 +1,9 @@ +from mailu.ui import ui, forms, access + +import flask + + +@ui.route('/language/', methods=['GET']) +def set_language(language=None): + flask.session['language'] = language + return flask.redirect(flask.url_for('.user_settings')) diff --git a/core/admin/mailu/utils.py b/core/admin/mailu/utils.py index c30f259e..e841e29d 100644 --- a/core/admin/mailu/utils.py +++ b/core/admin/mailu/utils.py @@ -46,8 +46,16 @@ babel = flask_babel.Babel() @babel.localeselector def get_locale(): """ selects locale for translation """ - translations = [str(translation) for translation in babel.list_translations()] - return flask.request.accept_languages.best_match(translations) + translations = list(map(str, babel.list_translations())) + flask.session['available_languages'] = translations + + try: + language = flask.session['language'] + except KeyError: + language = flask.request.accept_languages.best_match(translations) + flask.session['language'] = language + + return language # Proxy fixer diff --git a/core/admin/package.json b/core/admin/package.json index 77f39986..d45dcb94 100644 --- a/core/admin/package.json +++ b/core/admin/package.json @@ -12,20 +12,20 @@ "author": "", "license": "ISC", "dependencies": { - "@babel/core": "^7.14.6", - "admin-lte": "^2.4.18", - "babel-loader": "^8.0.6", - "css-loader": "^2.1.1", - "expose-loader": "^0.7.5", + "@babel/core": "^7.15.0", + "@babel/preset-env": "^7.15.0", + "admin-lte": "^3.1.0", + "babel-loader": "^8.2.2", + "css-loader": "^6.2.0", + "expose-loader": "^3.0.0", "jquery": "^3.6.0", - "less": "^3.13.1", - "less-loader": "^5.0.0", - "mini-css-extract-plugin": "^1.2.1", - "node-sass": "^4.13.1", - "sass-loader": "^7.3.1", + "less": "^4.1.1", + "less-loader": "^10.0.1", + "mini-css-extract-plugin": "^2.2.0", + "node-sass": "^6.0.1", + "sass-loader": "^12.1.0", "select2": "^4.0.13", - "url-loader": "^2.3.0", - "webpack": "^4.33.0", - "webpack-cli": "^3.3.12" + "webpack": "^5.50.0", + "webpack-cli": "^4.7.2" } } diff --git a/core/admin/webpack.config.js b/core/admin/webpack.config.js index 73630439..3e823fa9 100644 --- a/core/admin/webpack.config.js +++ b/core/admin/webpack.config.js @@ -30,19 +30,23 @@ module.exports = { test: /\.css$/, use: [css.loader, 'css-loader'] }, - { - test: /\.woff($|\?)|\.woff2($|\?)|\.ttf($|\?)|\.eot($|\?)|\.svg($|\?)/, - use: ['url-loader'] - }, { // Exposes jQuery for use outside Webpack build test: require.resolve('jquery'), use: [{ loader: 'expose-loader', - options: 'jQuery' - }, { - loader: 'expose-loader', - options: '$' + options: { + exposes: [ + { + globalName: '$', + override: true, + }, + { + globalName: 'jQuery', + override: true, + }, + ] + }, }] } ] diff --git a/core/postfix/conf/main.cf b/core/postfix/conf/main.cf index 7f84ade7..99c5179a 100644 --- a/core/postfix/conf/main.cf +++ b/core/postfix/conf/main.cf @@ -59,7 +59,7 @@ tls_ssl_options = NO_COMPRESSION, NO_TICKET smtp_tls_mandatory_protocols = !SSLv2, !SSLv3 smtp_tls_protocols =!SSLv2,!SSLv3 smtp_tls_security_level = {{ OUTBOUND_TLS_LEVEL|default('may') }} -smtp_tls_policy_maps=hash:/etc/postfix/tls_policy.map +smtp_tls_policy_maps=lmdb:/etc/postfix/tls_policy.map smtp_tls_CApath = /etc/ssl/certs smtp_tls_session_cache_database = lmdb:/dev/shm/postfix/smtp_scache smtpd_tls_session_cache_database = lmdb:/dev/shm/postfix/smtpd_scache diff --git a/towncrier/newsfragments/1567.feature b/towncrier/newsfragments/1567.feature new file mode 100644 index 00000000..8dc1515a --- /dev/null +++ b/towncrier/newsfragments/1567.feature @@ -0,0 +1 @@ +Implement a language selector for the admin interface. diff --git a/towncrier/newsfragments/1764.feature b/towncrier/newsfragments/1764.feature new file mode 100644 index 00000000..7eb51624 --- /dev/null +++ b/towncrier/newsfragments/1764.feature @@ -0,0 +1 @@ +Implement AdminLTE 3 for the admin interface.