mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Allow to hide payment methods behind a secret link
This commit is contained in:
@@ -53,6 +53,8 @@ event_patterns = [
|
||||
csrf_exempt(pretix.presale.views.cart.CartAdd.as_view()),
|
||||
name='event.cart.add'),
|
||||
|
||||
url(r'unlock/(?P<hash>[a-z0-9]{64})/$', pretix.presale.views.user.UnlockHashView.as_view(),
|
||||
name='event.payment.unlock'),
|
||||
url(r'resend/$', pretix.presale.views.user.ResendLinkView.as_view(), name='event.resend_link'),
|
||||
|
||||
url(r'^order/(?P<order>[^/]+)/(?P<secret>[A-Za-z0-9]+)/open/(?P<hash>[a-z0-9]+)/$', pretix.presale.views.order.OrderOpen.as_view(),
|
||||
|
||||
@@ -5,6 +5,7 @@ from django.contrib import messages
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.views import View
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from pretix.base.email import get_email_context
|
||||
@@ -60,3 +61,13 @@ class ResendLinkView(EventViewMixin, TemplateView):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['form'] = self.link_form
|
||||
return context
|
||||
|
||||
|
||||
class UnlockHashView(EventViewMixin, View):
|
||||
# Allows to register an unlock hash in the user's session, e.g. to unlock a hidden payment provider
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
hashes = request.session.get('pretix_unlock_hashes', [])
|
||||
hashes.append(kwargs.get('hash'))
|
||||
request.session['pretix_unlock_hashes'] = hashes
|
||||
return redirect(eventreverse(self.request.event, 'presale:event.index'))
|
||||
|
||||
Reference in New Issue
Block a user