Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions openedx/core/djangoapps/user_api/accounts/settings_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ def account_settings(request):
context, account_settings_template = AccountSettingsRenderStarted.run_filter(
context=context, template_name=account_settings_template,
)

# If the user has a connected third party auth provider that is in the list of providers specified in
# `THIRD_PARTY_AUTH_READ_ONLY_EMAIL_PROVIDERS``, we want to make the email field read-only.
# We could have used the filter for this, but given that Ulmo no longer has the legacy Account Settings page,
# this is only temporary code.
target_providers = getattr(settings, 'THIRD_PARTY_AUTH_READ_ONLY_EMAIL_PROVIDERS', [])
providers = context.get('auth', {}).get('providers', [])
any_connected = any(p.get('id') in target_providers and p.get('connected', False) for p in providers)
if any_connected:
context['sync_learner_profile_data'] = True
context['enterprise_readonly_account_fields']['fields'].append('email')

except AccountSettingsRenderStarted.RenderInvalidAccountSettings as exc:
response = render_to_response(exc.account_settings_template, exc.template_context)
except AccountSettingsRenderStarted.RedirectToPage as exc:
Expand Down
Loading