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,12 +149,13 @@
{% endblocktrans %} {% endblocktrans %}
</p> </p>
{% if status.current_domain.name %}
<form class="form" method="post" <form class="form" method="post"
action="{% url 'letsencrypt:toggle_hooks' status.current_domain.name %}"> action="{% url 'letsencrypt:toggle_hooks' status.current_domain.name %}">
{% csrf_token %} {% csrf_token %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
{% if status.current_domain.name and status.current_domain.has_cert %} {% if status.current_domain.has_cert %}
<input type="checkbox" name="toggle_hooks" id="id_toggle_hooks" <input type="checkbox" name="toggle_hooks" id="id_toggle_hooks"
{% if 'enabled' in status.current_domain.manage_hooks_status %} {% if 'enabled' in status.current_domain.manage_hooks_status %}
checked checked
@ -174,35 +175,24 @@
</noscript> </noscript>
{% endif %} {% endif %}
<span> <span>
{% if status.current_domain.name %}
{% 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 %}
{% blocktrans with current_domain=status.current_domain.name %}
Let {{ box_name }} manage certificate renewal of the current domain
{% endblocktrans %}
{% endif %}
</span> </span>
</label> </label>
</div> </div>
<p class="help-block"> <p class="help-block">
{% if status.current_domain.name and status.current_domain.has_cert %} {% if status.current_domain.has_cert %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
If enabled, {{ box_name }} can make sure that all apps can use the If enabled, {{ box_name }} can make sure that all apps can use the
certificate as soon as it is renewed. certificate as soon as it is renewed.
{% endblocktrans %} {% endblocktrans %}
{% elif not status.current_domain.has_cert %} {% else %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
<b>No certificate available for the current domain.</b> <b>No certificate available for the current domain.</b>
First obtain a certificate to enable its management. First obtain a certificate to enable its management.
{% endblocktrans %} {% endblocktrans %}
{% else %}
{% blocktrans trimmed %}
<b>No current domain is configured.</b>
First configure a domain to enable management of its certificates.
{% endblocktrans %}
{% endif %} {% endif %}
</p> </p>
</form> </form>
@ -248,10 +238,11 @@
{% url 'ejabberd:index' as ejabberd_url %} {% url 'ejabberd:index' as ejabberd_url %}
{% 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 trimmed %} {% blocktrans trimmed %}
If enabled, the app <a href="{{ ejabberd_url }}">ejabberd</a> will also use the If enabled, the app <a href="{{ ejabberd_url }}">ejabberd</a>
Let's Encrypt certificate. will also use the Let's Encrypt certificate.
This will reduce warnings about self-signed certificates in client applications, This will reduce warnings about self-signed certificates in
and enable more wide-spread federation with other XMPP servers in the Internet. client applications, and enable more wide-spread federation with
other XMPP servers in the Internet.
{% endblocktrans %} {% endblocktrans %}
{% elif 'ejabberd' not in installed_modules %} {% elif 'ejabberd' not in installed_modules %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
@ -260,12 +251,20 @@
{% endblocktrans %} {% endblocktrans %}
{% else %} {% else %}
{% blocktrans trimmed %} {% blocktrans trimmed %}
To use a Let's Encrypt certificate for <a href="{{ ejabberd_url }}">ejabberd</a> To use a Let's Encrypt certificate for
chat server app, you must first enable certificate renewal of the current domain. <a href="{{ ejabberd_url }}">ejabberd</a> chat server app, you
must first enable certificate renewal of the current domain.
{% endblocktrans %} {% endblocktrans %}
{% endif %} {% endif %}
</p> </p>
</form> </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