Skip to content

Commit 64d2883

Browse files
viadannaxitij2000
authored andcommitted
feat: implements SHOW_REGISTRATION_LINKS feature toggle (#528)
(cherry picked from commit 3025ab5)
1 parent 17dd0ec commit 64d2883

File tree

12 files changed

+34
-13
lines changed

12 files changed

+34
-13
lines changed

cms/envs/common.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,9 @@
347347
# Allow public account creation
348348
'ALLOW_PUBLIC_ACCOUNT_CREATION': True,
349349

350+
# Allow showing the registration links
351+
'SHOW_REGISTRATION_LINKS': True,
352+
350353
# Whether or not the dynamic EnrollmentTrackUserPartition should be registered.
351354
'ENABLE_ENROLLMENT_TRACK_USER_PARTITION': True,
352355

cms/templates/howitworks.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ <h4 class="title">${_("Work in Teams")}</h4>
154154
</section>
155155
</div>
156156

157-
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')):
157+
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True):
158158
<div class="wrapper-content-cta wrapper">
159159
<section class="content content-cta">
160160
<header>

cms/templates/widgets/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ <h2 class="sr-only">${_("Account Navigation")}</h2>
268268
<li class="nav-item nav-not-signedin-help">
269269
<a href="${get_online_help_info(online_help_token)['doc_url']}" title="${_('Contextual Online Help')}" rel="noopener" target="_blank">${_("Help")}</a>
270270
</li>
271-
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')):
271+
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True):
272272
<li class="nav-item nav-not-signedin-signup">
273273
<a class="action action-signup" href="${settings.FRONTEND_REGISTER_URL}?next=${quote_plus(request.build_absolute_uri(settings.LOGIN_URL))}">${_("Sign Up")}</a>
274274
</li>

lms/envs/common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,15 @@
777777
# .. toggle_tickets: https://openedx.atlassian.net/browse/YONK-513
778778
'ALLOW_PUBLIC_ACCOUNT_CREATION': True,
779779

780+
# .. toggle_name: FEATURES['SHOW_REGISTRATION_LINKS']
781+
# .. toggle_implementation: DjangoSetting
782+
# .. toggle_default: True
783+
# .. toggle_description: Allow registration links. If this is disabled, users will no longer see buttons to the
784+
# the signup page.
785+
# .. toggle_use_cases: open_edx
786+
# .. toggle_creation_date: 2023-03-27
787+
'SHOW_REGISTRATION_LINKS': True,
788+
780789
# .. toggle_name: FEATURES['ENABLE_COOKIE_CONSENT']
781790
# .. toggle_implementation: DjangoSetting
782791
# .. toggle_default: False

lms/static/js/student_account/views/AccessView.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
this.platformName = options.platform_name;
7676
this.supportURL = options.support_link;
7777
this.passwordResetSupportUrl = options.password_reset_support_link;
78-
this.createAccountOption = options.account_creation_allowed;
78+
this.createAccountOption = options.account_creation_allowed && options.register_links_allowed;
79+
this.showRegisterLinks = options.register_links_allowed
7980
this.hideAuthWarnings = options.hide_auth_warnings || false;
8081
this.pipelineUserDetails = options.third_party_auth.pipeline_user_details;
8182
this.enterpriseName = options.enterprise_name || '';
@@ -161,7 +162,7 @@
161162
supportURL: this.supportURL,
162163
passwordResetSupportUrl: this.passwordResetSupportUrl,
163164
createAccountOption: this.createAccountOption,
164-
hideAuthWarnings: this.hideAuthWarnings,
165+
showRegisterLinks: this.showRegisterLinks,hideAuthWarnings: this.hideAuthWarnings,
165166
pipelineUserDetails: this.pipelineUserDetails,
166167
enterpriseName: this.enterpriseName,
167168
enterpriseSlugLoginURL: this.enterpriseSlugLoginURL,
@@ -186,8 +187,9 @@
186187

187188
this.subview.passwordHelp = new PasswordResetView({
188189
fields: data.fields,
189-
model: this.resetModel
190-
});
190+
model: this.resetModel,
191+
showRegisterLinks: this.showRegisterLinks
192+
});
191193

192194
// Listen for 'password-email-sent' event to toggle sub-views
193195
this.listenTo(this.subview.passwordHelp, 'password-email-sent', this.passwordEmailSent);
@@ -211,7 +213,8 @@
211213
hideAuthWarnings: this.hideAuthWarnings,
212214
is_require_third_party_auth_enabled: this.is_require_third_party_auth_enabled,
213215
enableCoppaCompliance: this.enable_coppa_compliance,
214-
});
216+
showRegisterLinks: this.showRegisterLinks
217+
});
215218

216219
// Listen for 'auth-complete' event so we can enroll/redirect the user appropriately.
217220
this.listenTo(this.subview.register, 'auth-complete', this.authComplete);

lms/static/js/student_account/views/FormView.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
initialize: function(data) {
3737
this.model = data.model;
38+
this.showRegisterLinks = data.showRegisterLinks;
3839
this.preRender(data);
3940

4041
this.tpl = $(this.tpl).html();
@@ -97,6 +98,7 @@
9798
supplementalText: data[i].supplementalText || '',
9899
supplementalLink: data[i].supplementalLink || '',
99100
loginIssueSupportLink: data[i].loginIssueSupportLink || '',
101+
showRegisterLinks: this.showRegisterLinks,
100102
isEnterpriseEnable: this.isEnterpriseEnable
101103
})));
102104
}

lms/static/js/student_account/views/LoginView.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
this.supportURL = data.supportURL;
5353
this.passwordResetSupportUrl = data.passwordResetSupportUrl;
5454
this.createAccountOption = data.createAccountOption;
55+
this.showRegisterLinks = data.showRegisterLinks;
5556
this.accountActivationMessages = data.accountActivationMessages;
5657
this.accountRecoveryMessages = data.accountRecoveryMessages;
5758
this.hideAuthWarnings = data.hideAuthWarnings;

lms/static/js/student_account/views/RegisterView.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@
8888
requiredStr: this.requiredStr,
8989
optionalStr: fields[i].name === 'marketing_emails_opt_in' ? '' : this.optionalStr,
9090
supplementalText: fields[i].supplementalText || '',
91-
supplementalLink: fields[i].supplementalLink || ''
92-
})));
91+
supplementalLink: fields[i].supplementalLink || '',
92+
showRegisterLinks: this.showRegisterLinks})));
9393
}
9494
html.push('</div>');
9595
return html;

lms/templates/header/navbar-not-authenticated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
courses_are_browsable = settings.FEATURES.get('COURSES_ARE_BROWSABLE')
2020
allows_login = not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register
2121
can_discover_courses = settings.FEATURES.get('ENABLE_COURSE_DISCOVERY')
22-
allow_public_account_creation = static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION'))
22+
allow_public_account_creation = static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True)
2323
should_redirect_to_authn_mfe = should_redirect_to_authn_microfrontend()
2424
%>
2525
<nav class="nav-links" aria-label=${_("Supplemental Links")}>

lms/templates/navigation/navbar-not-authenticated.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<a class="btn" href="/courses">${_("Explore Courses")}</a>
3535
</li>
3636
%endif
37-
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')):
37+
% if static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION')) and settings.FEATURES.get('SHOW_REGISTRATION_LINKS', True):
3838
<li class="item nav-global-04">
3939
<a class="btn btn-neutral btn-register" href="/register${login_query()}">${_("Register")}</a>
4040
</li>

0 commit comments

Comments
 (0)