mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user