Commit 789193ef by chrisndodge

Merge pull request #5166 from edx/cdodge/hotfix-disable-social-auth-for-white-labels

make the 'ENABLE_THIRD_PARTY_AUTH' feature flag be microsite aware
parents 5f4dd7bb 1379158e
...@@ -398,7 +398,7 @@ def register_user(request, extra_context=None): ...@@ -398,7 +398,7 @@ def register_user(request, extra_context=None):
# If third-party auth is enabled, prepopulate the form with data from the # If third-party auth is enabled, prepopulate the form with data from the
# selected provider. # selected provider.
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and pipeline.running(request): if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')) and pipeline.running(request):
running_pipeline = pipeline.get(request) running_pipeline = pipeline.get(request)
current_provider = provider.Registry.get_by_backend_name(running_pipeline.get('backend')) current_provider = provider.Registry.get_by_backend_name(running_pipeline.get('backend'))
overrides = current_provider.get_register_form_data(running_pipeline.get('kwargs')) overrides = current_provider.get_register_form_data(running_pipeline.get('kwargs'))
...@@ -577,7 +577,7 @@ def dashboard(request): ...@@ -577,7 +577,7 @@ def dashboard(request):
'provider_states': [], 'provider_states': [],
} }
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')):
context['duplicate_provider'] = pipeline.get_duplicate_provider(messages.get_messages(request)) context['duplicate_provider'] = pipeline.get_duplicate_provider(messages.get_messages(request))
context['provider_user_states'] = pipeline.get_provider_user_states(user) context['provider_user_states'] = pipeline.get_provider_user_states(user)
...@@ -861,7 +861,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un ...@@ -861,7 +861,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
redirect_url = None redirect_url = None
response = None response = None
running_pipeline = None running_pipeline = None
third_party_auth_requested = settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and pipeline.running(request) third_party_auth_requested = microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')) and pipeline.running(request)
third_party_auth_successful = False third_party_auth_successful = False
trumped_by_first_party_auth = bool(request.POST.get('email')) or bool(request.POST.get('password')) trumped_by_first_party_auth = bool(request.POST.get('email')) or bool(request.POST.get('password'))
user = None user = None
...@@ -885,10 +885,10 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un ...@@ -885,10 +885,10 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
username=username, backend_name=backend_name)) username=username, backend_name=backend_name))
return HttpResponseBadRequest( return HttpResponseBadRequest(
_("You've successfully logged into your {provider_name} account, but this account isn't linked with an {platform_name} account yet.").format( _("You've successfully logged into your {provider_name} account, but this account isn't linked with an {platform_name} account yet.").format(
platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME) platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME)
+ "<br/><br/>" + _("Use your {platform_name} username and password to log into {platform_name} below, " + "<br/><br/>" + _("Use your {platform_name} username and password to log into {platform_name} below, "
"and then link your {platform_name} account with {provider_name} from your dashboard.").format( "and then link your {platform_name} account with {provider_name} from your dashboard.").format(
platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME) platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME)
+ "<br/><br/>" + _("If you don't have an {platform_name} account yet, click <strong>Register Now</strong> at the top of the page.").format( + "<br/><br/>" + _("If you don't have an {platform_name} account yet, click <strong>Register Now</strong> at the top of the page.").format(
platform_name=settings.PLATFORM_NAME), platform_name=settings.PLATFORM_NAME),
content_type="text/plain", content_type="text/plain",
...@@ -1002,7 +1002,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un ...@@ -1002,7 +1002,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
}, },
context={ context={
'Google Analytics': { 'Google Analytics': {
'clientId': tracking_context.get('client_id') 'clientId': tracking_context.get('client_id')
} }
} }
) )
...@@ -1288,7 +1288,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many ...@@ -1288,7 +1288,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
getattr(settings, 'REGISTRATION_EXTRA_FIELDS', {}) getattr(settings, 'REGISTRATION_EXTRA_FIELDS', {})
) )
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and pipeline.running(request): if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')) and pipeline.running(request):
post_vars = dict(post_vars.items()) post_vars = dict(post_vars.items())
post_vars.update({'password': pipeline.make_random_password()}) post_vars.update({'password': pipeline.make_random_password()})
...@@ -1469,14 +1469,14 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many ...@@ -1469,14 +1469,14 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
registration_course_id = request.session.get('registration_course_id') registration_course_id = request.session.get('registration_course_id')
analytics.track( analytics.track(
user.id, user.id,
"edx.bi.user.account.registered", "edx.bi.user.account.registered",
{ {
"category": "conversion", "category": "conversion",
"label": registration_course_id "label": registration_course_id
}, },
context={ context={
'Google Analytics': { 'Google Analytics': {
'clientId': tracking_context.get('client_id') 'clientId': tracking_context.get('client_id')
} }
} }
) )
...@@ -1546,7 +1546,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many ...@@ -1546,7 +1546,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
redirect_url = try_change_enrollment(request) redirect_url = try_change_enrollment(request)
# Resume the third-party-auth pipeline if necessary. # Resume the third-party-auth pipeline if necessary.
if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and pipeline.running(request): if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')) and pipeline.running(request):
running_pipeline = pipeline.get(request) running_pipeline = pipeline.get(request)
redirect_url = pipeline.get_complete_url(running_pipeline['backend']) redirect_url = pipeline.get_complete_url(running_pipeline['backend'])
......
<%! from django.utils.translation import ugettext as _ %> <%! from django.utils.translation import ugettext as _ %>
<%! from django.template import RequestContext %> <%! from django.template import RequestContext %>
<%! from third_party_auth import pipeline %> <%! from third_party_auth import pipeline %>
<%! from microsite_configuration import microsite %>
<%! <%!
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
...@@ -223,7 +224,7 @@ ...@@ -223,7 +224,7 @@
<%include file='dashboard/_dashboard_info_language.html' /> <%include file='dashboard/_dashboard_info_language.html' />
%endif %endif
% if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): % if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')):
<li class="controls--account"> <li class="controls--account">
<span class="title"> <span class="title">
## Translators: this section lists all the third-party authentication providers (for example, Google and LinkedIn) the user can link with or unlink from their edX account. ## Translators: this section lists all the third-party authentication providers (for example, Google and LinkedIn) the user can link with or unlink from their edX account.
......
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
</div> </div>
</form> </form>
% if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): % if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')):
<span class="deco-divider"> <span class="deco-divider">
## Developers: this is a sentence fragment, which is usually frowned upon. The design of the pags uses this fragment to provide an "else" clause underneath a number of choices. It's OK to leave it. ## Developers: this is a sentence fragment, which is usually frowned upon. The design of the pags uses this fragment to provide an "else" clause underneath a number of choices. It's OK to leave it.
......
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
<ul class="message-copy"> </ul> <ul class="message-copy"> </ul>
</div> </div>
% if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): % if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')):
% if not running_pipeline: % if not running_pipeline:
......
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