if there are no admins when trying to access the control panel, tell the user how to make an admin from SSH
This commit is contained in:
parent
c0f4618bef
commit
9b8d85de45
|
@ -71,8 +71,10 @@ def json_response(data):
|
||||||
def index():
|
def index():
|
||||||
# Render the control panel. This route does not require user authentication
|
# Render the control panel. This route does not require user authentication
|
||||||
# so it must be safe!
|
# 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',
|
return render_template('index.html',
|
||||||
hostname=env['PRIMARY_HOSTNAME'],
|
hostname=env['PRIMARY_HOSTNAME'],
|
||||||
|
no_admins_exist=no_admins_exist,
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route('/me')
|
@app.route('/me')
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
|
<h1 style="margin: 1em; text-align: center">{{hostname}}</h1>
|
||||||
|
|
||||||
|
{% if no_admins_exist %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="col-md-offset-2 col-md-8">
|
||||||
|
<p class="text-danger">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:</p>
|
||||||
|
<pre>cd mailinabox
|
||||||
|
sudo tools/mail.py user make-admin your@emailaddress.com</pre>
|
||||||
|
<hr>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-offset-2 col-sm-8 col-md-offset-3 col-md-6 col-lg-offset-4 col-lg-4">
|
<div class="col-sm-offset-2 col-sm-8 col-md-offset-3 col-md-6 col-lg-offset-4 col-lg-4">
|
||||||
<center>
|
<center>
|
||||||
<h1 style="margin: 1em">{{hostname}}</h1>
|
|
||||||
<p style="margin: 2em">Log in here for your Mail-in-a-Box control panel.</p>
|
<p style="margin: 2em">Log in here for your Mail-in-a-Box control panel.</p>
|
||||||
</center>
|
</center>
|
||||||
|
|
||||||
|
@ -36,6 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function do_login() {
|
function do_login() {
|
||||||
if ($('#loginEmail').val() == "") {
|
if ($('#loginEmail').val() == "") {
|
||||||
|
|
Loading…
Reference in New Issue