Log pretix.customer.created when creating account through OIDC

This commit is contained in:
Raphael Michel
2023-09-06 09:55:56 +02:00
parent b43523ea65
commit e50db7844b

View File

@@ -761,6 +761,17 @@ class SSOLoginReturnView(RedirectBackMixin, View):
try:
customer.save(force_insert=True)
customer_created.send(customer.organizer, customer=customer)
customer.log_action('pretix.customer.created', user=self.request.user, data=dict(
identifier=identifier,
external_identifier=profile['uid'],
provider=self.provider.pk,
email=profile['email'],
phone=profile.get('phone') or None,
name_parts=name_parts,
is_active=True,
is_verified=True,
locale=request.LANGUAGE_CODE,
))
except IntegrityError:
# This might either be a race condition or the email address is taken
# by a different customer account