diff --git a/management/daemon.py b/management/daemon.py index aa0cf609..aebd6e14 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -71,8 +71,10 @@ def json_response(data): def index(): # Render the control panel. This route does not require user authentication # so it must be safe! + no_admins_exist = (len([user for user in get_mail_users(env, as_json=True) if "admin" in user['privileges']]) == 0) return render_template('index.html', hostname=env['PRIMARY_HOSTNAME'], + no_admins_exist=no_admins_exist, ) @app.route('/me') diff --git a/management/templates/login.html b/management/templates/login.html index bfeb13f4..8b3f438d 100644 --- a/management/templates/login.html +++ b/management/templates/login.html @@ -1,7 +1,20 @@ +

{{hostname}}

+ +{% if no_admins_exist %} +
+
+

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
+
+
+
+{% endif %} +
-

{{hostname}}

Log in here for your Mail-in-a-Box control panel.

@@ -36,6 +49,7 @@
+