Commit d4e1e3eb by Asad Iqbal Committed by GitHub

Merge pull request #15272 from edx/asadiqbal08/ENT-368

ENT-368 Hide Register or Sign In links in Header on Logistration
parents c2c32e72 cd896501
...@@ -328,19 +328,19 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -328,19 +328,19 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
("edx.org", "register_user"), ("edx.org", "register_user"),
) )
@ddt.unpack @ddt.unpack
def test_login_and_registration_form_signin_preserves_params(self, theme, url_name): def test_login_and_registration_form_signin_not_preserves_params(self, theme, url_name):
params = [ params = [
('course_id', 'edX/DemoX/Demo_Course'), ('course_id', 'edX/DemoX/Demo_Course'),
('enrollment_action', 'enroll'), ('enrollment_action', 'enroll'),
] ]
# The response should have a "Sign In" button with the URL # The response should not have a "Sign In" button with the URL
# that preserves the querystring params # that preserves the querystring params
with with_comprehensive_theme_context(theme): with with_comprehensive_theme_context(theme):
response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html") response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html")
expected_url = '/login?{}'.format(self._finish_auth_url_param(params + [('next', '/dashboard')])) expected_url = '/login?{}'.format(self._finish_auth_url_param(params + [('next', '/dashboard')]))
self.assertContains(response, expected_url) self.assertNotContains(response, expected_url)
# Add additional parameters: # Add additional parameters:
params = [ params = [
...@@ -356,7 +356,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi ...@@ -356,7 +356,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html") response = self.client.get(reverse(url_name), params, HTTP_ACCEPT="text/html")
expected_url = '/login?{}'.format(self._finish_auth_url_param(params)) expected_url = '/login?{}'.format(self._finish_auth_url_param(params))
self.assertContains(response, expected_url) self.assertNotContains(response, expected_url)
@mock.patch.dict(settings.FEATURES, {"ENABLE_THIRD_PARTY_AUTH": False}) @mock.patch.dict(settings.FEATURES, {"ENABLE_THIRD_PARTY_AUTH": False})
@ddt.data("signin_user", "register_user") @ddt.data("signin_user", "register_user")
......
...@@ -141,6 +141,7 @@ def login_and_registration_form(request, initial_mode="login"): ...@@ -141,6 +141,7 @@ def login_and_registration_form(request, initial_mode="login"):
'responsive': True, 'responsive': True,
'allow_iframing': True, 'allow_iframing': True,
'disable_courseware_js': True, 'disable_courseware_js': True,
'combined_login_and_register': True,
'disable_footer': not configuration_helpers.get_value( 'disable_footer': not configuration_helpers.get_value(
'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER', 'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER',
settings.FEATURES['ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER'] settings.FEATURES['ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER']
......
...@@ -136,7 +136,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -136,7 +136,7 @@ site_status_msg = get_site_status_msg(course_id)
</%block> </%block>
<%block name="navigation_other_global_links"> <%block name="navigation_other_global_links">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register:
% if settings.FEATURES.get('ENABLE_COURSE_DISCOVERY'): % if settings.FEATURES.get('ENABLE_COURSE_DISCOVERY'):
<li class="item nav-global-05"> <li class="item nav-global-05">
<a class="btn" href="/courses">${_("Explore Courses")}</a> <a class="btn" href="/courses">${_("Explore Courses")}</a>
...@@ -158,7 +158,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -158,7 +158,7 @@ site_status_msg = get_site_status_msg(course_id)
<ol class="right nav-courseware list-inline"> <ol class="right nav-courseware list-inline">
<%block name="navigation_sign_in"> <%block name="navigation_sign_in">
<li class="item nav-courseware-01"> <li class="item nav-courseware-01">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="btn btn-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Sign in")}</a> <a class="btn btn-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Sign in")}</a>
% else: % else:
......
...@@ -124,15 +124,16 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -124,15 +124,16 @@ site_status_msg = get_site_status_msg(course_id)
<nav aria-label="${_('Account')}" class="nav-account-management"> <nav aria-label="${_('Account')}" class="nav-account-management">
<div class="right nav-courseware list-inline"> <div class="right nav-courseware list-inline">
<div class="item nav-courseware-01"> <div class="item nav-courseware-01">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="btn btn-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Sign in")}</a> <a class="btn btn-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Sign in")}</a>
% else: % else:
<a class="btn btn-login" href="/login${login_query()}">${_("Sign in")}</a> <a class="btn btn-login" href="/login${login_query()}">${_("Sign in")}</a>
% endif % endif
% endif % endif
</div> </div>
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<div class="item nav-courseware-02"> <div class="item nav-courseware-02">
<a class="btn-neutral btn-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a> <a class="btn-neutral btn-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment