Skip to content

Commit

Permalink
fix: Handle None identity providers in _user_has_social_auth_record
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeramin committed Jan 28, 2025
1 parent 1fe67d3 commit cb76eb5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions openedx/features/enterprise_support/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit cb76eb5

Please sign in to comment.