registration: show only email address in post-registration message (#37923)

This commit is contained in:
Thomas NOËL 2019-12-11 14:00:00 +01:00
parent f17dad5213
commit ad3f27ef3c
3 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@
</p>
<p>
{% blocktrans with from_email=from_email %}
If you still have not received the instructions, add {{from_email}}
If you still have not received the instructions, add "{{from_email_address}}"
to your address book or authorized sender list, and then repeat the
registration process.
{% endblocktrans %}

View File

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import collections
from email.utils import parseaddr
import logging
import random
import re
@ -1153,6 +1154,7 @@ class RegistrationCompleteView(TemplateView):
def get_context_data(self, **kwargs):
kwargs['next_url'] = utils.select_next_url(self.request, settings.LOGIN_REDIRECT_URL)
kwargs['from_email'] = settings.DEFAULT_FROM_EMAIL
kwargs['from_email_address'] = parseaddr(settings.DEFAULT_FROM_EMAIL)[1]
return super(RegistrationCompleteView, self).get_context_data(
account_activation_days=settings.ACCOUNT_ACTIVATION_DAYS,
**kwargs)

View File

@ -32,6 +32,7 @@ def test_registration(app, db, settings, mailoutbox, external_redirect):
settings.LANGUAGE_CODE = 'en-us'
settings.A2_VALIDATE_EMAIL_DOMAIN = can_resolve_dns()
settings.DEFAULT_FROM_EMAIL = 'show only addr <noreply@example.net>'
# disable existing attributes
models.Attribute.objects.update(disabled=True)
@ -55,7 +56,8 @@ def test_registration(app, db, settings, mailoutbox, external_redirect):
assert 'Follow the instructions' in response.text
assert 'testbot@entrouvert.com' in response.text
assert 'considered as spam' in response.text
assert settings.DEFAULT_FROM_EMAIL in response.text
assert '"noreply@example.net"' in response.text
assert 'show only addr' not in response.text
assert len(mailoutbox) == 1
link = get_link_from_mail(mailoutbox[0])