forked from CGM_Public/pretix_original
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:
|
if settings.HAS_REDIS:
|
||||||
from django_redis import get_redis_connection
|
from django_redis import get_redis_connection
|
||||||
rc = get_redis_connection("redis")
|
rc = get_redis_connection("redis")
|
||||||
if rc.exists('pretix_resend_{}'.format(user)):
|
if rc.exists('pretix_resend_{}_{}'.format(request.event.pk, user)):
|
||||||
messages.error(request, _('We already sent you an email in the last 24 hours.'))
|
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'))
|
return redirect(eventreverse(self.request.event, 'presale:event.resend_link'))
|
||||||
else:
|
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)
|
orders = self.request.event.orders.filter(email__iexact=user)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user