File tree Expand file tree Collapse file tree
openedx/core/djangoapps/user_api/accounts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,6 +83,18 @@ def account_settings(request):
8383 context , account_settings_template = AccountSettingsRenderStarted .run_filter (
8484 context = context , template_name = account_settings_template ,
8585 )
86+
87+ # If the user has a connected third party auth provider that is in the list of providers specified in
88+ # `THIRD_PARTY_AUTH_READ_ONLY_EMAIL_PROVIDERS``, we want to make the email field read-only.
89+ # We could have used the filter for this, but given that Ulmo no longer has the legacy Account Settings page,
90+ # this is only temporary code.
91+ target_providers = getattr (settings , 'THIRD_PARTY_AUTH_READ_ONLY_EMAIL_PROVIDERS' , [])
92+ providers = context .get ('auth' , {}).get ('providers' , [])
93+ any_connected = any (p .get ('id' ) in target_providers and p .get ('connected' , False ) for p in providers )
94+ if any_connected :
95+ context ['sync_learner_profile_data' ] = True
96+ context ['enterprise_readonly_account_fields' ]['fields' ].append ('email' )
97+
8698 except AccountSettingsRenderStarted .RenderInvalidAccountSettings as exc :
8799 response = render_to_response (exc .account_settings_template , exc .template_context )
88100 except AccountSettingsRenderStarted .RedirectToPage as exc :
You can’t perform that action at this time.
0 commit comments