Confirm disabling all notifications (#1845)

This commit is contained in:
julia-luna
2020-11-05 18:40:53 +01:00
committed by GitHub
parent d08c811f3a
commit b51108ab22
3 changed files with 18 additions and 3 deletions

View File

@@ -0,0 +1,13 @@
{% extends "pretixcontrol/auth/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Disable notifications" %}{% endblock %}
{% block content %}
<form action="" method="post" class="form-signin">
{% csrf_token %}
<div class="text-center">
<p>Please confirm that you no longer want to receive notifications for any of your events.</p>
<p><button type="submit" class="btn btn-primary" value="Disable notifications">Disable notifications</button></p>
</div>
</form>
{% endblock %}

View File

@@ -576,7 +576,9 @@ class User2FARegenerateEmergencyView(RecentAuthenticationRequiredMixin, Template
class UserNotificationsDisableView(TemplateView):
def get(self, request, *args, **kwargs):
template_name = 'pretixcontrol/user/notifications_disable.html'
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
user.save()