Adds email config admin view (#2494)
This view lets you see your email configuration and send a test email.
This commit is contained in:
parent
ac8b060d58
commit
c314c9b5e3
11 changed files with 250 additions and 23 deletions
12
bookwyrm/templates/email/test/html_content.html
Normal file
12
bookwyrm/templates/email/test/html_content.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends 'email/html_layout.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
This is a test email.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
|
||||
{% endblock %}
|
4
bookwyrm/templates/email/test/subject.html
Normal file
4
bookwyrm/templates/email/test/subject.html
Normal file
|
@ -0,0 +1,4 @@
|
|||
{% load i18n %}
|
||||
{% blocktrans trimmed %}
|
||||
Test email
|
||||
{% endblocktrans %}
|
9
bookwyrm/templates/email/test/text_content.html
Normal file
9
bookwyrm/templates/email/test/text_content.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% extends 'email/text_layout.html' %}
|
||||
{% load i18n %}
|
||||
{% block content %}
|
||||
{% blocktrans trimmed %}
|
||||
This is a test email.
|
||||
{% endblocktrans %}
|
||||
|
||||
|
||||
{% endblock %}
|
96
bookwyrm/templates/settings/email_config.html
Normal file
96
bookwyrm/templates/settings/email_config.html
Normal file
|
@ -0,0 +1,96 @@
|
|||
{% extends 'settings/layout.html' %}
|
||||
{% load humanize %}
|
||||
{% load i18n %}
|
||||
{% load celery_tags %}
|
||||
|
||||
{% block title %}{% trans "Email Configuration" %}{% endblock %}
|
||||
|
||||
{% block header %}{% trans "Email Configuration" %}{% endblock %}
|
||||
|
||||
{% block panel %}
|
||||
|
||||
{% if error %}
|
||||
<div class="notification is-danger is-light">
|
||||
<span class="icon icon-x" aria-hidden="true"></span>
|
||||
<span>
|
||||
{% trans "Error sending test email:" %}
|
||||
{{ error }}
|
||||
</span>
|
||||
</div>
|
||||
{% elif success %}
|
||||
<div class="notification is-success is-light">
|
||||
<span class="icon icon-check" aria-hidden="true"></span>
|
||||
<span>
|
||||
{% trans "Successfully sent test email." %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<section class="block content">
|
||||
<dl>
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Email sender:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
{{ email_sender }}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Email backend:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
<code>{{ email_backend }}</code>
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Host:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
<code>{{ email_host }}</code>
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Host user:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
<code>{% firstof email_host_user "-" %}</code>
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Port:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
<code>{{ email_port }}</code>
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Use TLS:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
{{ email_use_tls|yesno }}
|
||||
</dd>
|
||||
|
||||
<dt class="is-pulled-left mr-5 has-text-weight-bold">
|
||||
{% trans "Use SSL:" %}
|
||||
</dt>
|
||||
<dd>
|
||||
{{ email_use_ssl|yesno }}
|
||||
</dd>
|
||||
</dl>
|
||||
</section>
|
||||
<section class="block content box">
|
||||
<p>
|
||||
{% blocktrans trimmed with email=request.user.email %}
|
||||
Send test email to {{ email }}
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<form action="{% url 'settings-email-config' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="button is-success">
|
||||
{% trans "Send test email" %}
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
|
@ -81,12 +81,14 @@
|
|||
{% url 'settings-imports' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Imports" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="menu-list">
|
||||
<li>
|
||||
{% url 'settings-celery' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Celery status" %}</a>
|
||||
</li>
|
||||
<li>
|
||||
{% url 'settings-email-config' as url %}
|
||||
<a href="{{ url }}"{% if url in request.path %} class="is-active" aria-selected="true"{% endif %}>{% trans "Email Configuration" %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if perms.bookwyrm.edit_instance_settings %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue