Allow to hide payment methods behind a secret link

This commit is contained in:
Raphael Michel
2020-02-05 18:09:27 +01:00
parent b387fba5f4
commit e83b8ac218
4 changed files with 92 additions and 2 deletions

View File

@@ -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'))