mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
ResendLinkView: Change text and logic of rate limiting
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user