Fix #122 -- Allow users to re-send order links (#197)

If the provided mail address has not ordered anything, there will still
be a mail generated and sent to an invalid mail address, to avoid
obvious timing attacks to determine active users.
This commit is contained in:
Tobias Kunze
2016-09-01 08:59:36 +02:00
committed by Raphael Michel
parent 841cfe52a2
commit 7e19effe3c
7 changed files with 189 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ from pretix.base.models import Event, Order
from pretix.multidomain.urlreverse import build_absolute_uri
logger = logging.getLogger('pretix.base.mail')
INVALID_ADDRESS = 'invalid-pretix-mail-address'
class TolerantDict(dict):
@@ -53,6 +54,9 @@ def mail(email: str, subject: str, template: str,
:raises MailOrderException: on obvious, immediate failures. Not raising an exception does not necessarily mean
that the email has been sent, just that it has been queued by the email backend.
"""
if email == INVALID_ADDRESS:
return
with language(locale):
if isinstance(template, LazyI18nString):
body = str(template)

View File

@@ -163,6 +163,18 @@ to your order for {event}.
You can change your order details and view the status of your order at
{url}
Best regards,
Your {event} team"""))
},
'mail_text_resend_all_links': {
'type': LazyI18nString,
'default': LazyI18nString.from_gettext(ugettext_noop("""Hello,
somebody requested a list of your orders for {event}.
The list is as follows:
{orders}
Best regards,
Your {event} team"""))
},