From 716e166b110e42c89c0586f69e235e9b2d8c4f5a Mon Sep 17 00:00:00 2001 From: kaiyou Date: Sun, 29 Oct 2017 18:13:59 +0100 Subject: [PATCH] Improve the sidebar, display site title and website link --- .env.dist | 6 +++++ admin/mailu/__init__.py | 10 ++++++-- admin/mailu/ui/templates/login.html | 21 +--------------- admin/mailu/ui/templates/sidebar.html | 36 +++++++++++++++++++++++---- admin/mailu/ui/views/domains.py | 3 +-- 5 files changed, 47 insertions(+), 29 deletions(-) diff --git a/.env.dist b/.env.dist index 90b1ba0c..96272524 100644 --- a/.env.dist +++ b/.env.dist @@ -85,6 +85,12 @@ WEB_ADMIN=/admin # Path to the webmail if enabled WEB_WEBMAIL=/webmail +# Website name +SITENAME=Mailu + +# Linked Website URL +WEBSITE=https://mailu.io + ################################### # Advanced settings ################################### diff --git a/admin/mailu/__init__.py b/admin/mailu/__init__.py index 66641ffc..2aa35b62 100644 --- a/admin/mailu/__init__.py +++ b/admin/mailu/__init__.py @@ -20,6 +20,8 @@ default_config = { 'HOSTNAMES': 'mail.mailu.io', 'DOMAIN': 'mailu.io', 'POSTMASTER': 'postmaster', + 'SITENAME': 'Mailu', + 'WEBSITE': 'https://mailu.io', 'DEBUG': False, 'BOOTSTRAP_SERVE_LOCAL': True, 'DKIM_PATH': '/dkim/{domain}.{selector}.key', @@ -32,6 +34,7 @@ default_config = { 'TLS_FLAVOR': 'cert', 'CERTS_PATH': '/certs', 'PASSWORD_SCHEME': 'SHA512-CRYPT', + 'WEBMAIL': 'none', } # Load configuration from the environment if available @@ -72,8 +75,11 @@ def handle_needs_login(): ) @app.context_processor -def inject_user(): - return dict(current_user=flask_login.current_user) +def inject_defaults(): + return dict( + current_user=flask_login.current_user, + config=app.config + ) # Import views from mailu import ui, internal diff --git a/admin/mailu/ui/templates/login.html b/admin/mailu/ui/templates/login.html index 7ace9802..26c47c08 100644 --- a/admin/mailu/ui/templates/login.html +++ b/admin/mailu/ui/templates/login.html @@ -1,17 +1,4 @@ -{% extends "base.html" %} - -{% block sidebar %} - -{% endblock %} +{% extends "form.html" %} {% block title %} {% trans %}Sign in{% endtrans %} @@ -20,9 +7,3 @@ {% block subtitle %} {% trans %}to access the administration tools{% endtrans %} {% endblock %} - -{% block content %} -{% call macros.box() %} -{{ macros.form(form) }} -{% endcall %} -{% endblock %} diff --git a/admin/mailu/ui/templates/sidebar.html b/admin/mailu/ui/templates/sidebar.html index 14abe241..5ef9733c 100644 --- a/admin/mailu/ui/templates/sidebar.html +++ b/admin/mailu/ui/templates/sidebar.html @@ -1,7 +1,10 @@ diff --git a/admin/mailu/ui/views/domains.py b/admin/mailu/ui/views/domains.py index f1145e83..048e1829 100644 --- a/admin/mailu/ui/views/domains.py +++ b/admin/mailu/ui/views/domains.py @@ -62,8 +62,7 @@ def domain_delete(domain_name): @access.domain_admin(models.Domain, 'domain_name') def domain_details(domain_name): domain = models.Domain.query.get(domain_name) or flask.abort(404) - return flask.render_template('domain/details.html', domain=domain, - config=app.config) + return flask.render_template('domain/details.html', domain=domain) @ui.route('/domain/genkeys/', methods=['GET', 'POST'])