From b8959036bfc7907869e058270f5caa78260e2348 Mon Sep 17 00:00:00 2001 From: Cody McGinnis Date: Sun, 27 Aug 2023 22:53:58 -0400 Subject: [PATCH] allow signup for social accounts when the provider is set up When a social provider is set up, the social account signup view is enabled. This seems to cover issue #2261, but it needs further testing. --- cookbook/helper/AllAuthCustomAdapter.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cookbook/helper/AllAuthCustomAdapter.py b/cookbook/helper/AllAuthCustomAdapter.py index 4975251a4..d3c03e433 100644 --- a/cookbook/helper/AllAuthCustomAdapter.py +++ b/cookbook/helper/AllAuthCustomAdapter.py @@ -20,7 +20,9 @@ class AllAuthCustomAdapter(DefaultAccountAdapter): if 'signup_token' in request.session and InviteLink.objects.filter(valid_until__gte=datetime.datetime.today(), used_by=None, uuid=request.session['signup_token']).exists(): signup_token = True - if (request.resolver_match.view_name == 'account_signup' or request.resolver_match.view_name == 'socialaccount_signup') and not settings.ENABLE_SIGNUP and not signup_token: + if request.resolver_match.view_name == 'account_signup' and not settings.ENABLE_SIGNUP and not signup_token: + return False + elif request.resolver_match.view_name == 'socialaccount_signup' and len(settings.SOCIAL_PROVIDERS) < 1: return False else: return super(AllAuthCustomAdapter, self).is_open_for_signup(request)