From 2f8866ef32c1dc9d9f8c377bf285a00372a0eac9 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 28 Apr 2015 07:11:41 -0400 Subject: [PATCH] if there are no users at all the warning on the control panel login screen was incorrect --- management/daemon.py | 2 ++ management/templates/login.html | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/management/daemon.py b/management/daemon.py index 3f179fc8..02d9084c 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -90,10 +90,12 @@ def json_response(data): def index(): # Render the control panel. This route does not require user authentication # so it must be safe! + no_users_exist = (len(get_mail_users(env)) == 0) no_admins_exist = (len(get_admins(env)) == 0) return render_template('index.html', hostname=env['PRIMARY_HOSTNAME'], storage_root=env['STORAGE_ROOT'], + no_users_exist=no_users_exist, no_admins_exist=no_admins_exist, ) diff --git a/management/templates/login.html b/management/templates/login.html index 2fd12435..9ece712a 100644 --- a/management/templates/login.html +++ b/management/templates/login.html @@ -1,12 +1,20 @@

{{hostname}}

-{% if no_admins_exist %} +{% if no_users_exist or no_admins_exist %}
+ {% if no_users_exist %} +

There are no users on this system! To make an administrative user, + log into this machine using SSH (like when you first set it up) and run:

+
cd mailinabox
+sudo tools/mail.py user add me@{{hostname}}
+sudo tools/mail.py user make-admin me@{{hostname}}
+ {% else %}

There are no administrative users on this system! To make an administrative user, log into this machine using SSH (like when you first set it up) and run:

cd mailinabox
-sudo tools/mail.py user make-admin your@emailaddress.com
+sudo tools/mail.py user make-admin me@{{hostname}} + {% endif %}