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

JU-11 Add the ability to customize the registration fields (DS-303) #691

Merged
merged 1 commit into from
Nov 21, 2022

Conversation

Henrrypg
Copy link

@Henrrypg Henrrypg commented Nov 11, 2022

This feature adds the ability to customize the registration form

Documentation

https://docs.google.com/document/d/1XpVO596QXbx6IAzo88jiHMxH08tCO3s-NXx85TWjrB0/edit

For further context about the implementation, you can refer to the PRs description from the Juniper migration, where the feature was added.

PRs from previous migration

About the code refactor

The idea is support this feature as a filter pipeline, so this refactor is in order to take it as example to sustent the filter in the upstream PR.

Testing

Microsite settings

   "EDNX_CUSTOM_REGISTRATION_FIELDS": [
       {
           "label": "Document Type",
           "name": "type_document",
           "options": [
               "DNI",
               "PASSPORT",
               "ID"
           ],
           "type": "select"
       },
       {
           "label": "Document Number",
           "name": "personal_id",
           "type": "text"
       },
       {
           "label": "Phone number",
           "name": "mobile",
           "type": "text"
       },
       {
           "label": "Address",
           "name": "address",
           "type": "text"
       },
       {
           "label": "Company Name",
           "name": "company",
           "type": "text"
       }
   ],
   "REGISTRATION_EXTRA_FIELDS": {
       "address": "required",
       "company": "optional",
       "country": "hidden",
       "gender": "required",
       "goals": "hidden",
       "honor_code": "hidden",
       "level_of_education": "hidden",
       "mailing_address": "hidden",
       "mobile": "required",
       "personal_id": "required",
       "terms_of_service": "required",
       "type_document": "required",
       "year_of_birth": "hidden"
   },
   "REGISTRATION_FIELD_ORDER": [
       "gender",
       "type_document",
       "personal_id",
       "email",
       "mobile",
       "address",
       "company"
   ],
   "extended_profile_fields": [
       "type_document",
       "personal_id",
       "mobile",
       "address",
       "company"
   ],
   "OPEN_EDX_FILTERS_CONFIG": {
        "org.openedx.learning.student.registration.render.started.v1": {
            "fail_silently": false,
            "pipeline": [
                "openedx.core.djangoapps.user_authn.views.registration_form.AddCustomFieldsBeforeRegistration"
            ]
        },
        "org.openedx.learning.student.settings.render.started.v1": {
                  "fail_silently": false,
                  "pipeline": [
                      "openedx.core.djangoapps.user_api.accounts.settings_views.AddCustomOptionsOnAccountSettings"
                  ]
              }
          }

Now you look at registration form in /register

image

in /admin/auth/user/
image

In account/settings you should look your custom field types, for this example Type Document as List instead of plain text.

image

@Henrrypg Henrrypg force-pushed the hpg/refactor_JU-11 branch 3 times, most recently from d152b75 to aaea436 Compare November 11, 2022 19:44
@Henrrypg Henrrypg changed the title feat: add custom field on register form JU-11 Add the ability to customize the registration fields (DS-303) Nov 11, 2022
@Henrrypg Henrrypg self-assigned this Nov 11, 2022
@Henrrypg
Copy link
Author

@mariajgrimaldi @felipemontoya what are your thoughts on this?

@Henrrypg
Copy link
Author

Thank you @MaferMazu, i focused in the implementation and forget to change these names. I made some changes, can you check again?

Copy link
Member

@JuanDavidBuitrago JuanDavidBuitrago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure with some classes names, but I think this would be a conversation in upstream PRs.

I tested it and it's working as expected

Copy link
Contributor

@MaferMazu MaferMazu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I tested the extra fields and the scripts. I had problems testing the alert on the login page (I tried using /login and /login.*, maybe is something wrong in my config); if you can test it, I don't have problems merging this.

On the other hand, please update the doc in this PR and in the drive for leave instructions on how to test this with filters and Tenant Config; we want to deprecate Microsite.

@Henrrypg Henrrypg merged commit 5a225ca into ednx-release/nuez.master Nov 21, 2022
@felipemontoya
Copy link
Member

I'm ok with the way this was implemented in this PR, but I wonder if we use the StudentRegistrationRequested for part of this logic.

Would it make sense to alter the form only at theme and later receive those fields in the StudentRegistrationRequested filter for processing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants