ENT-2818 | Added enterprise slug login's url on edx login page.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
requests = null,
|
||||
authComplete = false,
|
||||
PLATFORM_NAME = 'edX',
|
||||
ENTERPRISE_SLUG_LOGIN_URL = 'enterprise/login',
|
||||
USER_DATA = {
|
||||
email: 'xsy@edx.org',
|
||||
password: 'xsyisawesome',
|
||||
@@ -88,7 +89,8 @@
|
||||
model: model,
|
||||
resetModel: resetModel,
|
||||
thirdPartyAuth: THIRD_PARTY_AUTH,
|
||||
platformName: PLATFORM_NAME
|
||||
platformName: PLATFORM_NAME,
|
||||
enterpriseSlugLoginURL: ENTERPRISE_SLUG_LOGIN_URL
|
||||
});
|
||||
|
||||
// Spy on AJAX requests
|
||||
@@ -198,6 +200,13 @@
|
||||
expect($('.forgot-password')).toBeVisible();
|
||||
});
|
||||
|
||||
it('displays a link to the enterprise slug login', function() {
|
||||
createLoginView(this);
|
||||
|
||||
// Verify that the enterprise login link is displayed
|
||||
expect($('.enterprise-login')).toBeVisible();
|
||||
});
|
||||
|
||||
it('displays password reset success message after password reset request', function() {
|
||||
createLoginView(this);
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
this.hideAuthWarnings = options.hide_auth_warnings || false;
|
||||
this.pipelineUserDetails = options.third_party_auth.pipeline_user_details;
|
||||
this.enterpriseName = options.enterprise_name || '';
|
||||
this.enterpriseSlugLoginURL = options.enterprise_slug_login_url || '';
|
||||
this.isAccountRecoveryFeatureEnabled = options.is_account_recovery_feature_enabled || false;
|
||||
this.isMultipleUserEnterprisesFeatureEnabled =
|
||||
options.is_multiple_user_enterprises_feature_enabled || false;
|
||||
@@ -160,7 +161,8 @@
|
||||
createAccountOption: this.createAccountOption,
|
||||
hideAuthWarnings: this.hideAuthWarnings,
|
||||
pipelineUserDetails: this.pipelineUserDetails,
|
||||
enterpriseName: this.enterpriseName
|
||||
enterpriseName: this.enterpriseName,
|
||||
enterpriseSlugLoginURL: this.enterpriseSlugLoginURL
|
||||
});
|
||||
|
||||
// Listen for 'password-help' event to toggle sub-views
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
events: {
|
||||
'click .js-login': 'submitForm',
|
||||
'click .forgot-password': 'forgotPassword',
|
||||
'click .login-provider': 'thirdPartyAuth'
|
||||
'click .login-provider': 'thirdPartyAuth',
|
||||
'click .enterprise-login': 'enterpriseSlugLogin'
|
||||
},
|
||||
formType: 'login',
|
||||
requiredStr: '',
|
||||
@@ -54,6 +55,7 @@
|
||||
this.hideAuthWarnings = data.hideAuthWarnings;
|
||||
this.pipelineUserDetails = data.pipelineUserDetails;
|
||||
this.enterpriseName = data.enterpriseName;
|
||||
this.enterpriseSlugLoginURL = data.enterpriseSlugLoginURL;
|
||||
|
||||
this.listenTo(this.model, 'sync', this.saveSuccess);
|
||||
this.listenTo(this.resetModel, 'sync', this.resetEmail);
|
||||
@@ -137,6 +139,13 @@
|
||||
this.clearPasswordResetSuccess();
|
||||
},
|
||||
|
||||
enterpriseSlugLogin: function(event) {
|
||||
event.preventDefault();
|
||||
if (this.enterpriseSlugLoginURL) {
|
||||
window.location.href = this.enterpriseSlugLoginURL;
|
||||
}
|
||||
},
|
||||
|
||||
postFormSubmission: function() {
|
||||
this.clearPasswordResetSuccess();
|
||||
},
|
||||
|
||||
@@ -134,5 +134,6 @@
|
||||
|
||||
<% if( form === 'login' && name === 'password' ) { %>
|
||||
<button type="button" class="forgot-password field-link"><%- gettext("Need help logging in?") %></button>
|
||||
<button type="button" class="enterprise-login field-link"><%- gettext("Sign in with your company or school") %></button>
|
||||
<% } %>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,8 @@ from openedx.core.djangoapps.user_authn.views.registration_form import Registrat
|
||||
from openedx.features.enterprise_support.api import enterprise_customer_for_request
|
||||
from openedx.features.enterprise_support.utils import (
|
||||
handle_enterprise_cookies_for_logistration,
|
||||
update_logistration_context_for_enterprise
|
||||
get_enterprise_slug_login_url,
|
||||
update_logistration_context_for_enterprise,
|
||||
)
|
||||
from student.helpers import get_next_url_for_login_page
|
||||
from third_party_auth import pipeline
|
||||
@@ -211,7 +212,8 @@ def login_and_registration_form(request, initial_mode="login"):
|
||||
'account_creation_allowed': configuration_helpers.get_value(
|
||||
'ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION', True)),
|
||||
'is_account_recovery_feature_enabled': is_secondary_email_feature_enabled(),
|
||||
'is_multiple_user_enterprises_feature_enabled': is_multiple_user_enterprises_feature_enabled()
|
||||
'is_multiple_user_enterprises_feature_enabled': is_multiple_user_enterprises_feature_enabled(),
|
||||
'enterprise_slug_login_url': get_enterprise_slug_login_url()
|
||||
},
|
||||
'login_redirect_url': redirect_to, # This gets added to the query string of the "Sign In" button in header
|
||||
'responsive': True,
|
||||
|
||||
@@ -7,6 +7,7 @@ import json
|
||||
|
||||
from crum import get_current_request
|
||||
from django.conf import settings
|
||||
from django.urls import NoReverseMatch, reverse
|
||||
from django.utils.translation import ugettext as _
|
||||
from edx_django_utils.cache import TieredCache, get_cache_key
|
||||
from enterprise.models import EnterpriseCustomerUser
|
||||
@@ -17,6 +18,7 @@ from lms.djangoapps.branding.api import get_privacy_url
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_authn.cookies import standard_cookie_settings
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from student.helpers import get_next_url_for_login_page
|
||||
|
||||
|
||||
def get_data_consent_share_cache_key(user_id, course_id):
|
||||
@@ -315,3 +317,28 @@ def is_enterprise_learner(user):
|
||||
(bool): True if given user is an enterprise learner.
|
||||
"""
|
||||
return EnterpriseCustomerUser.objects.filter(user_id=user.id).exists()
|
||||
|
||||
|
||||
def get_enterprise_slug_login_url():
|
||||
"""
|
||||
Return the enterprise slug login's URL (enterprise/login) if it exists otherwise None
|
||||
"""
|
||||
try:
|
||||
return reverse('enterprise_slug_login')
|
||||
except NoReverseMatch:
|
||||
return None
|
||||
|
||||
|
||||
def get_provider_login_url(request, provider_id, redirect_url=None):
|
||||
"""
|
||||
Return the given provider's login URL.
|
||||
|
||||
This method is here to avoid the importing of pipeline and student app in enterprise.
|
||||
"""
|
||||
|
||||
provider_login_url = third_party_auth.pipeline.get_login_url(
|
||||
provider_id,
|
||||
third_party_auth.pipeline.AUTH_ENTRY_LOGIN,
|
||||
redirect_url=redirect_url if redirect_url else get_next_url_for_login_page(request)
|
||||
)
|
||||
return provider_login_url
|
||||
|
||||
@@ -103,7 +103,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/base.in
|
||||
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/base.in
|
||||
edx-django-utils==3.2.2 # via -r requirements/edx/base.in, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-when
|
||||
edx-drf-extensions==6.0.0 # via -r requirements/edx/base.in, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
|
||||
edx-enterprise==3.2.17 # via -r requirements/edx/base.in
|
||||
edx-enterprise==3.2.18 # via -r requirements/edx/base.in
|
||||
edx-i18n-tools==0.5.3 # via ora2
|
||||
edx-milestones==0.3.0 # via -r requirements/edx/base.in
|
||||
edx-opaque-keys[django]==2.1.0 # via -r requirements/edx/paver.txt, edx-bulk-grades, edx-ccx-keys, edx-completion, edx-drf-extensions, edx-enterprise, edx-milestones, edx-organizations, edx-proctoring, edx-user-state-client, edx-when, xmodule
|
||||
|
||||
@@ -115,7 +115,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/testing.txt
|
||||
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/testing.txt
|
||||
edx-django-utils==3.2.2 # via -r requirements/edx/testing.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-when
|
||||
edx-drf-extensions==6.0.0 # via -r requirements/edx/testing.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
|
||||
edx-enterprise==3.2.17 # via -r requirements/edx/testing.txt
|
||||
edx-enterprise==3.2.18 # via -r requirements/edx/testing.txt
|
||||
edx-i18n-tools==0.5.3 # via -r requirements/edx/testing.txt, ora2
|
||||
edx-lint==1.4.1 # via -r requirements/edx/testing.txt
|
||||
edx-milestones==0.3.0 # via -r requirements/edx/testing.txt
|
||||
|
||||
@@ -112,7 +112,7 @@ edx-django-release-util==0.4.4 # via -r requirements/edx/base.txt
|
||||
edx-django-sites-extensions==2.5.1 # via -r requirements/edx/base.txt
|
||||
edx-django-utils==3.2.2 # via -r requirements/edx/base.txt, django-config-models, edx-drf-extensions, edx-enterprise, edx-rest-api-client, edx-when
|
||||
edx-drf-extensions==6.0.0 # via -r requirements/edx/base.txt, edx-completion, edx-enterprise, edx-organizations, edx-proctoring, edx-rbac, edx-when, edxval
|
||||
edx-enterprise==3.2.17 # via -r requirements/edx/base.txt
|
||||
edx-enterprise==3.2.18 # via -r requirements/edx/base.txt
|
||||
edx-i18n-tools==0.5.3 # via -r requirements/edx/base.txt, -r requirements/edx/testing.in, ora2
|
||||
edx-lint==1.4.1 # via -r requirements/edx/testing.in
|
||||
edx-milestones==0.3.0 # via -r requirements/edx/base.txt
|
||||
|
||||
Reference in New Issue
Block a user