mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 01:35:28 +00:00
Add warning to dashboard if email sender looks misconfigured
This can be a really obscure error, hopefully this warning will catch potential issues.
This commit is contained in:
parent
4ccbfb6b31
commit
516c4a9790
2 changed files with 20 additions and 0 deletions
|
@ -37,6 +37,17 @@
|
|||
</div>
|
||||
|
||||
<div class="columns block is-multiline">
|
||||
{% if email_config_error %}
|
||||
<div class="column is-flex">
|
||||
<span class="notification is-warning is-block is-flex-grow-1">
|
||||
{% blocktrans trimmed %}
|
||||
Your outgoing email address, <code>{{ email_sender }}</code>, may be misconfigured.
|
||||
{% endblocktrans %}
|
||||
{% trans "Check the <code>EMAIL_SENDER_NAME</code> and <code>EMAIL_SENDER_DOMAIN</code> in your <code>.env</code>." %}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if reports %}
|
||||
<div class="column is-flex">
|
||||
<a href="{% url 'settings-reports' %}" class="notification is-warning is-block is-flex-grow-1">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
""" instance overview """
|
||||
from datetime import timedelta
|
||||
import re
|
||||
|
||||
from dateutil.parser import parse
|
||||
from packaging import version
|
||||
|
||||
|
@ -13,6 +15,7 @@ from django.views import View
|
|||
from bookwyrm import models, settings
|
||||
from bookwyrm.connectors.abstract_connector import get_data
|
||||
from bookwyrm.connectors.connector_manager import ConnectorException
|
||||
from bookwyrm.utils import regex
|
||||
|
||||
|
||||
# pylint: disable= no-self-use
|
||||
|
@ -88,6 +91,10 @@ class Dashboard(View):
|
|||
},
|
||||
)
|
||||
|
||||
email_config_error = re.findall(
|
||||
r"[\s\@]", settings.EMAIL_SENDER_DOMAIN
|
||||
) or not re.match(regex.DOMAIN, settings.EMAIL_SENDER_DOMAIN)
|
||||
|
||||
data = {
|
||||
"start": start.strftime("%Y-%m-%d"),
|
||||
"end": end.strftime("%Y-%m-%d"),
|
||||
|
@ -109,6 +116,8 @@ class Dashboard(View):
|
|||
"status_stats": status_chart.get_chart(start, end, interval),
|
||||
"register_stats": register_chart.get_chart(start, end, interval),
|
||||
"works_stats": works_chart.get_chart(start, end, interval),
|
||||
"email_config_error": email_config_error,
|
||||
"email_sender": f"{settings.EMAIL_SENDER_NAME}@{settings.EMAIL_SENDER_DOMAIN}",
|
||||
}
|
||||
|
||||
# check version
|
||||
|
|
Loading…
Reference in a new issue