From 1379158e8d136d1442b2e0b3dba418a6ce8aaa6c Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Wed, 10 Sep 2014 12:38:40 -0400 Subject: [PATCH 1/2] make the 'ENABLE_THIRD_PARTY_AUTH' feature flag be microsite aware --- common/djangoapps/student/views.py | 20 ++++++++++---------- lms/templates/dashboard.html | 3 ++- lms/templates/login.html | 2 +- lms/templates/register.html | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 49df99d4b5..fc3c2c0383 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -398,7 +398,7 @@ def register_user(request, extra_context=None): # If third-party auth is enabled, prepopulate the form with data from the # 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) current_provider = provider.Registry.get_by_backend_name(running_pipeline.get('backend')) overrides = current_provider.get_register_form_data(running_pipeline.get('kwargs')) @@ -577,7 +577,7 @@ def dashboard(request): '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['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 redirect_url = None response = 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 trumped_by_first_party_auth = bool(request.POST.get('email')) or bool(request.POST.get('password')) user = None @@ -885,10 +885,10 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un username=username, backend_name=backend_name)) return HttpResponseBadRequest( _("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) + "

" + _("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( - platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME) + platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME) + "

" + _("If you don't have an {platform_name} account yet, click Register Now at the top of the page.").format( platform_name=settings.PLATFORM_NAME), content_type="text/plain", @@ -1002,7 +1002,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un }, context={ '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 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.update({'password': pipeline.make_random_password()}) @@ -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') analytics.track( user.id, - "edx.bi.user.account.registered", + "edx.bi.user.account.registered", { "category": "conversion", "label": registration_course_id }, context={ '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 redirect_url = try_change_enrollment(request) # 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) redirect_url = pipeline.get_complete_url(running_pipeline['backend']) diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 3509fe0f6c..c011c33db4 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -1,6 +1,7 @@ <%! from django.utils.translation import ugettext as _ %> <%! from django.template import RequestContext %> <%! from third_party_auth import pipeline %> +<%! from microsite_configuration import microsite %> <%! from django.core.urlresolvers import reverse @@ -223,7 +224,7 @@ <%include file='dashboard/_dashboard_info_language.html' /> %endif - % if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): + % if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')):
  • ## 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. diff --git a/lms/templates/login.html b/lms/templates/login.html index 3b73266407..ae78227d33 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -194,7 +194,7 @@ - % if settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH'): + % if microsite.get_value('ENABLE_THIRD_PARTY_AUTH', settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH')): ## 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. diff --git a/lms/templates/register.html b/lms/templates/register.html index 365fb17ff5..666f9c0873 100644 --- a/lms/templates/register.html +++ b/lms/templates/register.html @@ -116,7 +116,7 @@
    - % 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: From 8f1a285c33af8837fc58c5668d688e4da3949164 Mon Sep 17 00:00:00 2001 From: Feanil Patel Date: Wed, 10 Sep 2014 14:44:49 -0400 Subject: [PATCH 2/2] Downgrade gunicorn. --- requirements/edx/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 67e53509b7..37ee134e28 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -39,7 +39,7 @@ firebase-token-generator==1.3.2 fs==0.4.0 GitPython==0.3.2.RC1 glob2==0.3 -gunicorn==19.1.1 +gunicorn==0.17.4 lazy==1.1 lxml==3.0.1 mako==0.9.1