letsencrypt: Handle case where current domain is empty

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
James Valleroy 2017-10-17 06:03:23 -04:00
parent 7c2c18abfb
commit b87388ae3c
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -149,123 +149,122 @@
{% endblocktrans %} {% endblocktrans %}
</p> </p>
<form class="form" method="post" {% if status.current_domain.name %}
action="{% url 'letsencrypt:toggle_hooks' status.current_domain.name %}"> <form class="form" method="post"
{% csrf_token %} action="{% url 'letsencrypt:toggle_hooks' status.current_domain.name %}">
<div class="checkbox"> {% csrf_token %}
<label> <div class="checkbox">
{% if status.current_domain.name and status.current_domain.has_cert %} <label>
<input type="checkbox" name="toggle_hooks" id="id_toggle_hooks" {% if status.current_domain.has_cert %}
{% if 'enabled' in status.current_domain.manage_hooks_status %} <input type="checkbox" name="toggle_hooks" id="id_toggle_hooks"
checked {% if 'enabled' in status.current_domain.manage_hooks_status %}
{% endif %} checked
onchange="this.form.submit();"> {% endif %}
</input> onchange="this.form.submit();">
<noscript> </input>
<button class="btn btn-sm btn-default" type="submit"> <noscript>
{% trans "Update config" %}</button> <button class="btn btn-sm btn-default" type="submit">
</noscript> {% trans "Update config" %}</button>
{% else %} </noscript>
<input type="checkbox" name="toggle_hooks" id="id_toggle_hooks" {% else %}
class="disabled"></input> <input type="checkbox" name="toggle_hooks" id="id_toggle_hooks"
<noscript> class="disabled"></input>
<button class="btn btn-sm btn-default disabled" type="submit"> <noscript>
{% trans "Update config" %}</button> <button class="btn btn-sm btn-default disabled" type="submit">
</noscript> {% trans "Update config" %}</button>
{% endif %} </noscript>
<span> {% endif %}
{% if status.current_domain.name %} <span>
{% blocktrans with current_domain=status.current_domain.name %} {% blocktrans with current_domain=status.current_domain.name %}
Let {{ box_name }} manage certificate renewal of Let {{ box_name }} manage certificate renewal of
<b>{{ current_domain }}</b> <b>{{ current_domain }}</b>
{% endblocktrans %} {% endblocktrans %}
{% else %} </span>
{% blocktrans with current_domain=status.current_domain.name %} </label>
Let {{ box_name }} manage certificate renewal of the current domain </div>
{% endblocktrans %} <p class="help-block">
{% endif %} {% if status.current_domain.has_cert %}
</span> {% blocktrans trimmed %}
</label> If enabled, {{ box_name }} can make sure that all apps can use the
</div> certificate as soon as it is renewed.
<p class="help-block"> {% endblocktrans %}
{% if status.current_domain.name and status.current_domain.has_cert %}
{% blocktrans trimmed %}
If enabled, {{ box_name }} can make sure that all apps can use the
certificate as soon as it is renewed.
{% endblocktrans %}
{% elif not status.current_domain.has_cert %}
{% blocktrans trimmed %}
<b>No certificate available for the current domain.</b>
First obtain a certificate to enable its management.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
<b>No current domain is configured.</b>
First configure a domain to enable management of its certificates.
{% endblocktrans %}
{% endif %}
</p>
</form>
<form class="form" method="post"
action="{% url 'letsencrypt:toggle_module' domain=status.current_domain.name module='ejabberd' %}">
{% csrf_token %}
<div class="checkbox">
<label>
{% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %}
<input type="checkbox" name="ejabberd" id="ejabberd"
{% if 'ejabberd' in status.current_domain.manage_hooks_status %}
checked
{% endif %}
onchange="this.form.submit();">
</input>
<noscript>
<button class="btn btn-sm btn-default" type="submit">
{% trans "Update config" %}</button>
</noscript>
{% else %} {% else %}
<input type="checkbox" name="ejabberd" id="ejabberd" {% blocktrans trimmed %}
class="disabled"></input> <b>No certificate available for the current domain.</b>
<noscript> First obtain a certificate to enable its management.
<button class="btn btn-sm btn-default disabled" type="submit"> {% endblocktrans %}
{% trans "Update config" %}</button>
</noscript>
{% endif %} {% endif %}
<span> </p>
</form>
<form class="form" method="post"
action="{% url 'letsencrypt:toggle_module' domain=status.current_domain.name module='ejabberd' %}">
{% csrf_token %}
<div class="checkbox">
<label>
{% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %} {% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %}
{% blocktrans with current_domain=status.current_domain.name %} <input type="checkbox" name="ejabberd" id="ejabberd"
Use certificate of {{ current_domain }} for <b>ejabberd</b> {% if 'ejabberd' in status.current_domain.manage_hooks_status %}
{% endblocktrans %} checked
{% endif %}
onchange="this.form.submit();">
</input>
<noscript>
<button class="btn btn-sm btn-default" type="submit">
{% trans "Update config" %}</button>
</noscript>
{% else %} {% else %}
{% blocktrans %} <input type="checkbox" name="ejabberd" id="ejabberd"
Use certificate of the current domain for <b>ejabberd</b> class="disabled"></input>
{% endblocktrans %} <noscript>
<button class="btn btn-sm btn-default disabled" type="submit">
{% trans "Update config" %}</button>
</noscript>
{% endif %} {% endif %}
</span> <span>
</label> {% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %}
</div> {% blocktrans with current_domain=status.current_domain.name %}
<p class="help-block"> Use certificate of {{ current_domain }} for <b>ejabberd</b>
{% url 'ejabberd:index' as ejabberd_url %} {% endblocktrans %}
{% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %} {% else %}
{% blocktrans trimmed %} {% blocktrans %}
If enabled, the app <a href="{{ ejabberd_url }}">ejabberd</a> will also use the Use certificate of the current domain for <b>ejabberd</b>
Let's Encrypt certificate. {% endblocktrans %}
This will reduce warnings about self-signed certificates in client applications, {% endif %}
and enable more wide-spread federation with other XMPP servers in the Internet. </span>
{% endblocktrans %} </label>
{% elif 'ejabberd' not in installed_modules %} </div>
{% blocktrans trimmed %} <p class="help-block">
This feature only makes sense if you are using the {% url 'ejabberd:index' as ejabberd_url %}
<a href="{{ ejabberd_url }}">ejabberd</a> chat server app. {% if 'ejabberd' in installed_modules and 'enabled' in status.current_domain.manage_hooks_status %}
{% endblocktrans %} {% blocktrans trimmed %}
{% else %} If enabled, the app <a href="{{ ejabberd_url }}">ejabberd</a>
{% blocktrans trimmed %} will also use the Let's Encrypt certificate.
To use a Let's Encrypt certificate for <a href="{{ ejabberd_url }}">ejabberd</a> This will reduce warnings about self-signed certificates in
chat server app, you must first enable certificate renewal of the current domain. client applications, and enable more wide-spread federation with
{% endblocktrans %} other XMPP servers in the Internet.
{% endif %} {% endblocktrans %}
</p> {% elif 'ejabberd' not in installed_modules %}
</form> {% blocktrans trimmed %}
This feature only makes sense if you are using the
<a href="{{ ejabberd_url }}">ejabberd</a> chat server app.
{% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
To use a Let's Encrypt certificate for
<a href="{{ ejabberd_url }}">ejabberd</a> chat server app, you
must first enable certificate renewal of the current domain.
{% endblocktrans %}
{% endif %}
</p>
</form>
{% else %}
{% blocktrans trimmed %}
<b>No current domain is configured.</b>
First configure a domain to enable management of its certificates.
{% endblocktrans %}
{% endif %}
{% else %} {% else %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
No domains have been configured. Configure domains to be able to No domains have been configured. Configure domains to be able to