From 611af39d536df71d736cef57d11ef1eb0490db87 Mon Sep 17 00:00:00 2001 From: Brittney Exline Date: Thu, 22 Jun 2017 14:18:18 -0400 Subject: [PATCH] ENT-447 Add ability to hide auth warnings for enterprise context. When a user comes in through an sso provider and arrives at the login or registration page, there is a warning message that comes up to indicate that the user has to take an action to sign in and register and thus link their sso account to their edx account. However, it is confusing, particularly for the enterpise context. This diff disables these messages from being rendered if these pages are being shown in an enterprise context. --- lms/djangoapps/student_account/views.py | 1 + lms/static/js/student_account/views/AccessView.js | 7 +++++-- lms/static/js/student_account/views/LoginView.js | 7 +++++-- lms/static/js/student_account/views/RegisterView.js | 3 ++- requirements/edx/base.txt | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lms/djangoapps/student_account/views.py b/lms/djangoapps/student_account/views.py index f7c35463c2..9996eb5293 100644 --- a/lms/djangoapps/student_account/views.py +++ b/lms/djangoapps/student_account/views.py @@ -220,6 +220,7 @@ def update_context_for_enterprise(request, context): ) context.update(sidebar_context) context['enable_enterprise_sidebar'] = True + context['data']['hide_auth_warnings'] = True else: context['enable_enterprise_sidebar'] = False diff --git a/lms/static/js/student_account/views/AccessView.js b/lms/static/js/student_account/views/AccessView.js index 1049b6de94..c04a8bbe7b 100644 --- a/lms/static/js/student_account/views/AccessView.js +++ b/lms/static/js/student_account/views/AccessView.js @@ -74,6 +74,7 @@ this.supportURL = options.support_link; this.passwordResetSupportUrl = options.password_reset_support_link; this.createAccountOption = options.account_creation_allowed; + this.hideAuthWarnings = options.hide_auth_warnings || false; // The login view listens for 'sync' events from the reset model this.resetModel = new PasswordResetModel({}, { @@ -131,7 +132,8 @@ platformName: this.platformName, supportURL: this.supportURL, passwordResetSupportUrl: this.passwordResetSupportUrl, - createAccountOption: this.createAccountOption + createAccountOption: this.createAccountOption, + hideAuthWarnings: this.hideAuthWarnings }); // Listen for 'password-help' event to toggle sub-views @@ -167,7 +169,8 @@ fields: data.fields, model: model, thirdPartyAuth: this.thirdPartyAuth, - platformName: this.platformName + platformName: this.platformName, + hideAuthWarnings: this.hideAuthWarnings }); // Listen for 'auth-complete' event so we can enroll/redirect the user appropriately. diff --git a/lms/static/js/student_account/views/LoginView.js b/lms/static/js/student_account/views/LoginView.js index bcdd578f0f..fde0d4bfb4 100644 --- a/lms/static/js/student_account/views/LoginView.js +++ b/lms/static/js/student_account/views/LoginView.js @@ -48,6 +48,7 @@ this.passwordResetSupportUrl = data.passwordResetSupportUrl; this.createAccountOption = data.createAccountOption; this.accountActivationMessages = data.accountActivationMessages; + this.hideAuthWarnings = data.hideAuthWarnings; this.listenTo(this.model, 'sync', this.saveSuccess); this.listenTo(this.resetModel, 'sync', this.resetEmail); @@ -193,8 +194,10 @@ if (error.status === 403 && error.responseText === 'third-party-auth' && this.currentProvider) { - this.clearFormErrors(); - this.renderAuthWarning(); + if (!this.hideAuthWarnings) { + this.clearFormErrors(); + this.renderAuthWarning(); + } } else { this.renderErrors(this.defaultFormErrorsTitle, this.errors); } diff --git a/lms/static/js/student_account/views/RegisterView.js b/lms/static/js/student_account/views/RegisterView.js index 3d47fbdefe..918cad4f61 100644 --- a/lms/static/js/student_account/views/RegisterView.js +++ b/lms/static/js/student_account/views/RegisterView.js @@ -37,6 +37,7 @@ this.errorMessage = data.thirdPartyAuth.errorMessage || ''; this.platformName = data.platformName; this.autoSubmit = data.thirdPartyAuth.autoSubmitRegForm; + this.hideAuthWarnings = data.hideAuthWarnings; this.listenTo(this.model, 'sync', this.saveSuccess); }, @@ -63,7 +64,7 @@ // Must be called after postRender, since postRender sets up $formFeedback. if (this.errorMessage) { this.renderErrors(formErrorsTitle, [this.errorMessage]); - } else if (this.currentProvider) { + } else if (this.currentProvider && !this.hideAuthWarnings) { this.renderAuthWarning(); } diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 72dc2642b1..23e3684f82 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -52,7 +52,7 @@ edx-lint==0.4.3 astroid==1.3.8 edx-django-oauth2-provider==1.1.4 edx-django-sites-extensions==2.1.1 -edx-enterprise==0.36.3 +edx-enterprise==0.36.5 edx-oauth2-provider==1.2.0 edx-opaque-keys==0.4.0 edx-organizations==0.4.4