From e33d15429ed1cd6ba61dfd8c7bf5afd3ccb7e114 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 26 Jan 2021 16:52:08 +0100 Subject: [PATCH] ResendLinkView: Change text and logic of rate limiting --- src/pretix/presale/views/user.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pretix/presale/views/user.py b/src/pretix/presale/views/user.py index a032b098e5..cf550d3ad3 100644 --- a/src/pretix/presale/views/user.py +++ b/src/pretix/presale/views/user.py @@ -32,11 +32,14 @@ class ResendLinkView(EventViewMixin, TemplateView): if settings.HAS_REDIS: from django_redis import get_redis_connection rc = get_redis_connection("redis") - if rc.exists('pretix_resend_{}'.format(user)): - messages.error(request, _('We already sent you an email in the last 24 hours.')) + if rc.exists('pretix_resend_{}_{}'.format(request.event.pk, user)): + messages.error(request, _('If the email address you entered is valid and associated with a ticket, we have ' + 'already sent you an email with a link to your ticket in the past {number} hours. ' + 'If the email did not arrive, please your check spam folder and also double check ' + 'that you used the correct email address.').format(number=24)) return redirect(eventreverse(self.request.event, 'presale:event.resend_link')) else: - rc.setex('pretix_resend_{}'.format(user), 3600 * 24, '1') + rc.setex('pretix_resend_{}_{}'.format(request.event.pk, user), 3600 * 24, '1') orders = self.request.event.orders.filter(email__iexact=user)