From 5de7824b66a0d80f2324eefce7c6f433259aee77 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Wed, 1 Jul 2026 10:37:36 +0200 Subject: [PATCH] add migration for setting --- ...customerssoprovider_allow_convert_to_sso.py | 18 ++++++++++++++++++ src/pretix/base/models/customers.py | 2 +- src/pretix/control/forms/organizer.py | 2 +- src/tests/presale/test_customer.py | 4 ++-- 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 src/pretix/base/migrations/0302_customerssoprovider_allow_convert_to_sso.py diff --git a/src/pretix/base/migrations/0302_customerssoprovider_allow_convert_to_sso.py b/src/pretix/base/migrations/0302_customerssoprovider_allow_convert_to_sso.py new file mode 100644 index 0000000000..a1aed380b0 --- /dev/null +++ b/src/pretix/base/migrations/0302_customerssoprovider_allow_convert_to_sso.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.12 on 2026-07-01 08:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("pretixbase", "0301_reusablemedium_remove_orderposition"), + ] + + operations = [ + migrations.AddField( + model_name="customerssoprovider", + name="allow_convert_to_sso", + field=models.BooleanField(default=False), + ), + ] diff --git a/src/pretix/base/models/customers.py b/src/pretix/base/models/customers.py index 1456d58ca1..734924b650 100644 --- a/src/pretix/base/models/customers.py +++ b/src/pretix/base/models/customers.py @@ -79,7 +79,7 @@ class CustomerSSOProvider(LoggedModel): help_text=_( "If enabled, when an existing customer registered with email and password tries to login through this SSO provider, pretix changes the account to single-sign-on. Otherwise pretix does not allow to log in." ), - ), + ) configuration = models.JSONField() def allow_delete(self): diff --git a/src/pretix/control/forms/organizer.py b/src/pretix/control/forms/organizer.py index 0078562506..8ff8df62ac 100644 --- a/src/pretix/control/forms/organizer.py +++ b/src/pretix/control/forms/organizer.py @@ -1244,7 +1244,7 @@ class SSOProviderForm(I18nModelForm): class Meta: model = CustomerSSOProvider - fields = ['is_active', 'name', 'button_label', 'method'] + fields = ['is_active', 'name', 'button_label', 'method', 'allow_convert_to_sso'] widgets = { 'method': forms.RadioSelect, } diff --git a/src/tests/presale/test_customer.py b/src/tests/presale/test_customer.py index 3bd84f9d79..e9c2872c18 100644 --- a/src/tests/presale/test_customer.py +++ b/src/tests/presale/test_customer.py @@ -441,9 +441,9 @@ def test_org_sso_login_new_customer_email_conflict(env, client, provider): @pytest.mark.django_db(transaction=True) def test_org_sso_convert_customer_on_login(env, client, provider): organizer = env[0] + provider.allow_convert_to_sso = True + provider.save() with scopes_disabled(): - provider.allow_convert_to_sso = True - provider.save() customer = organizer.customers.create(email='new@example.net', is_verified=True, is_active=False) customer.set_password('foo') customer.save()