Event cancellation: Add safety and security checks (#5565)

* Event cancellation: Add safety and security checks

When cancelling an event, a large sum of money might be refunded
instantly. This PR adds safety features around this by

- doing a dry-run first that shows a preview of the expected refund sum

- sending a confirmation mode via email for any automatic refunds of more than 100 currency units

- keeping a more detailed log of the settings this was executed with

* Update src/pretix/control/views/orders.py

Co-authored-by: luelista <weller@rami.io>

---------

Co-authored-by: luelista <weller@rami.io>
This commit is contained in:
Raphael Michel
2025-10-29 08:53:48 +01:00
committed by GitHub
parent e386ed4352
commit 1e0ede529c
9 changed files with 422 additions and 103 deletions

View File

@@ -1030,3 +1030,27 @@ class EventCancelForm(FormPlaceholderMixin, forms.Form):
if self.event.has_subevents and not d['subevent'] and not d['all_subevents'] and not d.get('subevents_from'):
raise ValidationError(_('Please confirm that you want to cancel ALL dates in this event series.'))
return d
class EventCancelConfirmForm(forms.Form):
confirm = forms.BooleanField(
label=_("I understand that this is not reversible and want to continue"),
required=True,
)
confirmation_code = forms.CharField(
label=_("Confirmation code"),
help_text=_("We have just emailed you a confirmation code to enter to confirm this action"),
required=True,
)
def __init__(self, *args, **kwargs):
self.code = kwargs.pop("confirmation_code")
super().__init__(*args, **kwargs)
if not self.code:
del self.fields["confirmation_code"]
def clean_confirmation_code(self):
val = self.cleaned_data['confirmation_code']
if val != self.code:
raise ValidationError(_('The confirmation code is incorrect.'))
return val