Skip to content

Commit

Permalink
feat: implements SHOW_REGISTRATION_LINKS feature toggle
Browse files Browse the repository at this point in the history
(cherry picked from commit 3025ab5)
(cherry picked from commit 2ee57b7d59ed53fa928f9b19127038b4cf0b4620)
  • Loading branch information
viadanna authored and yusuf-musleh committed Aug 3, 2023
1 parent e100302 commit e9b99b3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
13 changes: 7 additions & 6 deletions lms/static/js/student_account/views/AccessView.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
this.supportURL = options.support_link;
this.passwordResetSupportUrl = options.password_reset_support_link;
this.createAccountOption = options.account_creation_allowed && options.register_links_allowed;
this.showRegisterLinks = options.register_links_allowed
this.showRegisterLinks = options.register_links_allowed;
this.hideAuthWarnings = options.hide_auth_warnings || false;
this.pipelineUserDetails = options.third_party_auth.pipeline_user_details;
this.enterpriseName = options.enterprise_name || '';
Expand Down Expand Up @@ -162,7 +162,8 @@
supportURL: this.supportURL,
passwordResetSupportUrl: this.passwordResetSupportUrl,
createAccountOption: this.createAccountOption,
showRegisterLinks: this.showRegisterLinks,hideAuthWarnings: this.hideAuthWarnings,
showRegisterLinks: this.showRegisterLinks,
hideAuthWarnings: this.hideAuthWarnings,
pipelineUserDetails: this.pipelineUserDetails,
enterpriseName: this.enterpriseName,
enterpriseSlugLoginURL: this.enterpriseSlugLoginURL,
Expand All @@ -188,8 +189,8 @@
this.subview.passwordHelp = new PasswordResetView({
fields: data.fields,
model: this.resetModel,
showRegisterLinks: this.showRegisterLinks
});
showRegisterLinks: this.showRegisterLinks
});

// Listen for 'password-email-sent' event to toggle sub-views
this.listenTo(this.subview.passwordHelp, 'password-email-sent', this.passwordEmailSent);
Expand All @@ -213,8 +214,8 @@
hideAuthWarnings: this.hideAuthWarnings,
is_require_third_party_auth_enabled: this.is_require_third_party_auth_enabled,
enableCoppaCompliance: this.enable_coppa_compliance,
showRegisterLinks: this.showRegisterLinks
});
showRegisterLinks: this.showRegisterLinks
});

// Listen for 'auth-complete' event so we can enroll/redirect the user appropriately.
this.listenTo(this.subview.register, 'auth-complete', this.authComplete);
Expand Down
6 changes: 5 additions & 1 deletion lms/static/js/student_account/views/FormView.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@
optionalStr: gettext('(optional)'),
submitButton: '',
isEnterpriseEnable: false,
showRegisterLinks: true,

initialize: function(data) {
this.model = data.model;
this.showRegisterLinks = data.showRegisterLinks;
this.showRegisterLinks = (
typeof data.showRegisterLinks !== 'undefined'
) ? data.showRegisterLinks : this.showRegisterLinks;

this.preRender(data);

this.tpl = $(this.tpl).html();
Expand Down
4 changes: 3 additions & 1 deletion lms/static/js/student_account/views/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
this.supportURL = data.supportURL;
this.passwordResetSupportUrl = data.passwordResetSupportUrl;
this.createAccountOption = data.createAccountOption;
this.showRegisterLinks = data.showRegisterLinks;
this.showRegisterLinks = (
typeof data.showRegisterLinks !== 'undefined'
) ? data.showRegisterLinks : this.showRegisterLinks;
this.accountActivationMessages = data.accountActivationMessages;
this.accountRecoveryMessages = data.accountRecoveryMessages;
this.hideAuthWarnings = data.hideAuthWarnings;
Expand Down
3 changes: 2 additions & 1 deletion lms/static/js/student_account/views/RegisterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
optionalStr: fields[i].name === 'marketing_emails_opt_in' ? '' : this.optionalStr,
supplementalText: fields[i].supplementalText || '',
supplementalLink: fields[i].supplementalLink || '',
showRegisterLinks: this.showRegisterLinks})));
showRegisterLinks: this.showRegisterLinks
})));
}
html.push('</div>');
return html;
Expand Down

0 comments on commit e9b99b3

Please sign in to comment.