mirror of
https://github.com/pretix/pretix.git
synced 2026-09-14 16:24:43 +00:00
Email settings: Block with invalid SPF setup (#3471)
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body form-horizontal">
|
<div class="panel-body form-horizontal">
|
||||||
{% if spf_warning %}
|
{% if spf_warning %}
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-danger">
|
||||||
<p>
|
<p>
|
||||||
{{ spf_warning }}
|
{{ spf_warning }}
|
||||||
</p>
|
</p>
|
||||||
@@ -70,10 +70,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group submit-group">
|
{% if spf_warning %}
|
||||||
<button type="submit" class="btn btn-primary btn-save">
|
<div class="form-group submit-group">
|
||||||
{% trans "Save" %}
|
<a href="" class="btn btn-default btn-save">
|
||||||
</button>
|
{% trans "Cancel" %}
|
||||||
</div>
|
</a>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="form-group submit-group">
|
||||||
|
<button type="submit" class="btn btn-primary btn-save">
|
||||||
|
{% trans "Save" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -192,8 +192,8 @@ class MailSettingsSetupView(TemplateView):
|
|||||||
spf_record = get_spf_record(hostname)
|
spf_record = get_spf_record(hostname)
|
||||||
if not spf_record:
|
if not spf_record:
|
||||||
spf_warning = _(
|
spf_warning = _(
|
||||||
'We could not find an SPF record set for the domain you are trying to use. You can still '
|
'We could not find an SPF record set for the domain you are trying to use. This means that '
|
||||||
'proceed, but it will increase the chance of emails going to spam or being rejected. We '
|
'there is a very high change most of the emails will be rejected or markes as spam. We '
|
||||||
'strongly recommend setting an SPF record on the domain. You can do so through the DNS '
|
'strongly recommend setting an SPF record on the domain. You can do so through the DNS '
|
||||||
'settings at the provider you registered your domain with.'
|
'settings at the provider you registered your domain with.'
|
||||||
)
|
)
|
||||||
@@ -205,7 +205,8 @@ class MailSettingsSetupView(TemplateView):
|
|||||||
'this system in the SPF record.'
|
'this system in the SPF record.'
|
||||||
)
|
)
|
||||||
|
|
||||||
if settings.MAIL_CUSTOM_SENDER_VERIFICATION_REQUIRED:
|
verification = settings.MAIL_CUSTOM_SENDER_VERIFICATION_REQUIRED and not spf_warning
|
||||||
|
if verification:
|
||||||
if 'verification' in self.request.POST:
|
if 'verification' in self.request.POST:
|
||||||
messages.error(request, _('The verification code was incorrect, please try again.'))
|
messages.error(request, _('The verification code was incorrect, please try again.'))
|
||||||
else:
|
else:
|
||||||
@@ -230,7 +231,7 @@ class MailSettingsSetupView(TemplateView):
|
|||||||
context={
|
context={
|
||||||
'basetpl': self.basetpl,
|
'basetpl': self.basetpl,
|
||||||
'object': self.object,
|
'object': self.object,
|
||||||
'verification': settings.MAIL_CUSTOM_SENDER_VERIFICATION_REQUIRED,
|
'verification': verification,
|
||||||
'spf_warning': spf_warning,
|
'spf_warning': spf_warning,
|
||||||
'spf_record': spf_record,
|
'spf_record': spf_record,
|
||||||
'spf_key': settings.MAIL_CUSTOM_SENDER_SPF_STRING,
|
'spf_key': settings.MAIL_CUSTOM_SENDER_SPF_STRING,
|
||||||
|
|||||||
@@ -633,7 +633,7 @@ class EventsTest(SoupTest):
|
|||||||
},
|
},
|
||||||
follow=True
|
follow=True
|
||||||
)
|
)
|
||||||
assert doc.select('.alert-warning')
|
assert doc.select('.alert-danger')
|
||||||
self.event1.settings.flush()
|
self.event1.settings.flush()
|
||||||
# not yet saved
|
# not yet saved
|
||||||
assert "mail_from" not in self.event1.settings._cache()
|
assert "mail_from" not in self.event1.settings._cache()
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ class OrganizerTest(SoupTest):
|
|||||||
},
|
},
|
||||||
follow=True
|
follow=True
|
||||||
)
|
)
|
||||||
assert doc.select('.alert-warning')
|
assert doc.select('.alert-danger')
|
||||||
self.orga1.settings.flush()
|
self.orga1.settings.flush()
|
||||||
# not yet saved
|
# not yet saved
|
||||||
assert "mail_from" not in self.orga1.settings._cache()
|
assert "mail_from" not in self.orga1.settings._cache()
|
||||||
|
|||||||
Reference in New Issue
Block a user