fix: Handle None identity providers in _user_has_social_auth_record

This commit is contained in:
Muhammad Sameer Amin
2025-01-28 18:32:30 +05:00
parent 1fe67d3f6b
commit cb76eb5aa4

View File

@@ -294,9 +294,12 @@ def _user_has_social_auth_record(user, enterprise_customer):
identity_provider = third_party_auth.provider.Registry.get(
provider_id=idp['provider_id']
)
provider_backend_names.append(identity_provider.backend_name)
return UserSocialAuth.objects.select_related('user').\
filter(provider__in=provider_backend_names, user=user).exists()
if identity_provider and hasattr(identity_provider, 'backend_name'):
provider_backend_names.append(identity_provider.backend_name)
if provider_backend_names:
return UserSocialAuth.objects.select_related('user').\
filter(provider__in=provider_backend_names, user=user).exists()
return False