From 20ec388b036afaccaa40a06374a1e771ac76b90e Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Mon, 9 Nov 2020 20:05:14 +0100 Subject: [PATCH] Fix disabling notifications when logged in --- src/pretix/control/views/user.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pretix/control/views/user.py b/src/pretix/control/views/user.py index 913c965e8..b2d6f74ee 100644 --- a/src/pretix/control/views/user.py +++ b/src/pretix/control/views/user.py @@ -22,6 +22,7 @@ from django.views import View from django.views.generic import FormView, ListView, TemplateView, UpdateView from django_otp.plugins.otp_static.models import StaticDevice from django_otp.plugins.otp_totp.models import TOTPDevice +from django_scopes import scopes_disabled from pretix.base.auth import get_auth_backends from pretix.base.forms.auth import ReauthForm @@ -578,6 +579,10 @@ class User2FARegenerateEmergencyView(RecentAuthenticationRequiredMixin, Template class UserNotificationsDisableView(TemplateView): template_name = 'pretixcontrol/user/notifications_disable.html' + @scopes_disabled() + def dispatch(self, request, *args, **kwargs): + return super().dispatch(self, request, *args, **kwargs) + def post(self, request, *args, **kwargs): user = get_object_or_404(User, notifications_token=kwargs.get('token'), pk=kwargs.get('id')) user.notifications_send = False