From 9083c49f07089b4bc0844a86adc188fcd7f6de29 Mon Sep 17 00:00:00 2001 From: Will Daly Date: Mon, 29 Sep 2014 09:16:38 -0400 Subject: [PATCH] Put student profile third party auth behind a feature flag --- lms/djangoapps/student_profile/views.py | 15 ++++--- lms/templates/student_profile/index.html | 45 ++----------------- .../student_profile/third_party_auth.html | 44 ++++++++++++++++++ 3 files changed, 56 insertions(+), 48 deletions(-) create mode 100644 lms/templates/student_profile/third_party_auth.html diff --git a/lms/djangoapps/student_profile/views.py b/lms/djangoapps/student_profile/views.py index dc58795a48..078183c54c 100644 --- a/lms/djangoapps/student_profile/views.py +++ b/lms/djangoapps/student_profile/views.py @@ -4,6 +4,7 @@ from django.http import ( QueryDict, HttpResponse, HttpResponseBadRequest, HttpResponseServerError ) +from django.conf import settings from django_future.csrf import ensure_csrf_cookie from django.contrib.auth.decorators import login_required from django.views.decorators.http import require_http_methods @@ -32,12 +33,14 @@ def index(request): """ user = request.user - return render_to_response( - 'student_profile/index.html', { - 'disable_courseware_js': True, - 'provider_user_states': pipeline.get_provider_user_states(user), - } - ) + context = { + 'disable_courseware_js': True + } + + if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): + context['provider_user_states'] = pipeline.get_provider_user_states(user) + + return render_to_response('student_profile/index.html', context) @login_required diff --git a/lms/templates/student_profile/index.html b/lms/templates/student_profile/index.html index c2d829b056..87fcde2e96 100644 --- a/lms/templates/student_profile/index.html +++ b/lms/templates/student_profile/index.html @@ -1,5 +1,4 @@ <%! from django.utils.translation import ugettext as _ %> -<%! from third_party_auth import pipeline %> <%namespace name='static' file='/static_content.html'/> <%inherit file="../main.html" /> @@ -25,44 +24,6 @@ -
  • - - ## 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. - ${_("Connected Accounts")} - - - - % for state in provider_user_states: - - % endfor - -
  • +% if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): + <%include file="third_party_auth.html" /> +% endif diff --git a/lms/templates/student_profile/third_party_auth.html b/lms/templates/student_profile/third_party_auth.html new file mode 100644 index 0000000000..d1d2ccb5ac --- /dev/null +++ b/lms/templates/student_profile/third_party_auth.html @@ -0,0 +1,44 @@ +<%! from django.utils.translation import ugettext as _ %> +<%! from third_party_auth import pipeline %> + +
  • + + ## 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. + ${_("Connected Accounts")} + + + + % for state in provider_user_states: + + % endfor + +