Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: prefill custom fields in the registration form with TPA data #43

Merged
Merged
Show file tree
Hide file tree
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
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
Loading