Compare commits

...

2 Commits

Author SHA1 Message Date
Richard Schreiber
e70a903875 fix flake8 2025-03-12 12:26:30 +01:00
Richard Schreiber
fa0aa71c5c Fix race-condition when creating a customer 2025-03-12 12:23:04 +01:00

View File

@@ -257,18 +257,21 @@ class RegistrationForm(forms.Form):
return self.cleaned_data
def create(self):
customer = self.request.organizer.customers.create(
customer, created = self.request.organizer.customers.get_or_create(
email=self.cleaned_data['email'],
name_parts=self.cleaned_data['name_parts'],
phone=self.cleaned_data.get('phone'),
is_active=True,
is_verified=False,
locale=get_language_without_region(),
defaults={
"name_parts": self.cleaned_data['name_parts'],
"phone": self.cleaned_data.get('phone'),
"is_active": True,
"is_verified": False,
"locale": get_language_without_region(),
}
)
customer.set_unusable_password()
customer.save()
customer.log_action('pretix.customer.created', {})
customer.send_activation_mail()
if created:
customer.set_unusable_password()
customer.save()
customer.log_action('pretix.customer.created', {})
customer.send_activation_mail()
return customer