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.
This commit is contained in:
Cody McGinnis
2023-08-27 22:53:58 -04:00
parent 4ffc9cc72f
commit b8959036bf

View File

@@ -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)