Skip to content

Commit

Permalink
feat: prefill custom fields in the registration form with TPA data (#43)
Browse files Browse the repository at this point in the history
(cherry picked from commit f99b720)
  • Loading branch information
andrey-canon authored Dec 3, 2024
1 parent 941b30b commit 23f6bf4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -4534,6 +4534,12 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring

REGISTRATION_EXTENSION_FORM = None

# .. setting_name: REGISTRATION_EXTENSION_FORM_FIELDS_TPA_OVERRIDES
# .. setting_default: []
# .. setting_description: List of custom fields included in the registriation
# form extension to be prefilled with third party auth data.
REGISTRATION_EXTENSION_FORM_FIELDS_TPA_OVERRIDES = []

# Identifier included in the User Agent from open edX mobile apps.
MOBILE_APP_USER_AGENT_REGEXES = [
r'edX/org.edx.mobile',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,13 @@ def _apply_third_party_auth_overrides(self, request, form_desc):
current_provider.skip_registration_form and enterprise_customer_for_request(request)
) or current_provider.sync_learner_profile_data
)
registration_fields = (
self.DEFAULT_FIELDS
+ self.EXTRA_FIELDS
+ settings.REGISTRATION_EXTENSION_FORM_FIELDS_TPA_OVERRIDES
)

for field_name in self.DEFAULT_FIELDS + self.EXTRA_FIELDS:
for field_name in registration_fields:
if field_name in field_overrides:
form_desc.override_field_properties(
field_name, default=field_overrides[field_name]
Expand Down

0 comments on commit 23f6bf4

Please sign in to comment.