From e9b99b394ebbc7cfde8d5cc3f0482da420f4db86 Mon Sep 17 00:00:00 2001 From: Paulo Viadanna Date: Thu, 30 Mar 2023 11:12:35 -0300 Subject: [PATCH] feat: implements SHOW_REGISTRATION_LINKS feature toggle (cherry picked from commit 3025ab5fe6f6f53d6af5b36681355efafa37c74b) (cherry picked from commit 2ee57b7d59ed53fa928f9b19127038b4cf0b4620) --- lms/static/js/student_account/views/AccessView.js | 13 +++++++------ lms/static/js/student_account/views/FormView.js | 6 +++++- lms/static/js/student_account/views/LoginView.js | 4 +++- lms/static/js/student_account/views/RegisterView.js | 3 ++- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/lms/static/js/student_account/views/AccessView.js b/lms/static/js/student_account/views/AccessView.js index 6c5b3d2be696..2c4822b33f19 100644 --- a/lms/static/js/student_account/views/AccessView.js +++ b/lms/static/js/student_account/views/AccessView.js @@ -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 || ''; @@ -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, @@ -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); @@ -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); diff --git a/lms/static/js/student_account/views/FormView.js b/lms/static/js/student_account/views/FormView.js index 5a9a269612af..770313ed5aaa 100644 --- a/lms/static/js/student_account/views/FormView.js +++ b/lms/static/js/student_account/views/FormView.js @@ -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(); diff --git a/lms/static/js/student_account/views/LoginView.js b/lms/static/js/student_account/views/LoginView.js index 3fe530db907a..2d5126709db2 100644 --- a/lms/static/js/student_account/views/LoginView.js +++ b/lms/static/js/student_account/views/LoginView.js @@ -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; diff --git a/lms/static/js/student_account/views/RegisterView.js b/lms/static/js/student_account/views/RegisterView.js index f463c6bfd2f6..73a65d71de8e 100644 --- a/lms/static/js/student_account/views/RegisterView.js +++ b/lms/static/js/student_account/views/RegisterView.js @@ -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(''); return html;