From 93a263b92f07ab6663886c8a7c7c67aafd1755c1 Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Tue, 2 Sep 2014 18:06:50 -0400 Subject: [PATCH 1/6] Correct 3rd party auth login page message and styling --- common/djangoapps/student/views.py | 17 ++++++++++------- .../third_party_auth/tests/specs/base.py | 6 ++---- lms/static/sass/multicourse/_account.scss | 8 ++++++++ lms/templates/login.html | 10 ++++++++-- lms/templates/register.html | 2 +- 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 9b0c880e3e..6d5f33758d 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -883,13 +883,16 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un AUDIT_LOG.warning( u'Login failed - user with username {username} has no social auth with backend_name {backend_name}'.format( username=username, backend_name=backend_name)) - return JsonResponse({ - "success": False, - # Translators: provider_name is the name of an external, third-party user authentication service (like - # Google or LinkedIn). - "value": _('There is no {platform_name} account associated with your {provider_name} account. Please use your {platform_name} credentials or pick another provider.').format( - platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME) - }) # TODO: this should be a status code 401 # pylint: disable=fixme + return HttpResponseBadRequest( + _("You've successfully logged into your {provider_name} account, but this account " + "isn't linked with an {platform_name} account yet. 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.") + "

" + _("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, provider_name=requested_provider.NAME), + content_type="text/plain", + status=401 + ) else: diff --git a/common/djangoapps/third_party_auth/tests/specs/base.py b/common/djangoapps/third_party_auth/tests/specs/base.py index 0ba253c27e..6d5ec1e353 100644 --- a/common/djangoapps/third_party_auth/tests/specs/base.py +++ b/common/djangoapps/third_party_auth/tests/specs/base.py @@ -220,10 +220,8 @@ class IntegrationTest(testutil.TestCase, test.TestCase): def assert_json_failure_response_is_missing_social_auth(self, response): """Asserts failure on /login for missing social auth looks right.""" - self.assertEqual(200, response.status_code) # Yes, it's a 200 even though it's a failure. - payload = json.loads(response.content) - self.assertFalse(payload.get('success')) - self.assertIn('associated with your %s account' % self.PROVIDER_CLASS.NAME, payload.get('value')) + self.assertEqual(401, response.status_code) + self.assertIn("successfully logged into your %s account, but this account isn't linked" % self.PROVIDER_CLASS.NAME, response.content) def assert_json_failure_response_is_username_collision(self, response): """Asserts the json response indicates a username collision.""" diff --git a/lms/static/sass/multicourse/_account.scss b/lms/static/sass/multicourse/_account.scss index 00b19e636d..c8e1a6cbd0 100644 --- a/lms/static/sass/multicourse/_account.scss +++ b/lms/static/sass/multicourse/_account.scss @@ -610,6 +610,14 @@ display: block; } } + + .third-party-signin.message { + display: none; + + &.is-shown { + display: block; + } + } } } diff --git a/lms/templates/login.html b/lms/templates/login.html index 9ab2e0e2fe..3b73266407 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -46,8 +46,10 @@ toggleSubmitButton(false); }); - $('#login-form').on('ajax:error', function() { + $('#login-form').on('ajax:error', function(event, request, status_string) { toggleSubmitButton(true); + $('.third-party-signin.message').addClass('is-shown').focus(); + $('.third-party-signin.message .instructions').html(request.responseText); }); $('#login-form').on('ajax:success', function(event, json, xhr) { @@ -138,12 +140,16 @@ + +

${_('Please provide the following information to log into your {platform_name} account. Required fields are noted by bold text and an asterisk (*).').format(platform_name=platform_name)}

diff --git a/lms/templates/register.html b/lms/templates/register.html index aa587951f0..365fb17ff5 100644 --- a/lms/templates/register.html +++ b/lms/templates/register.html @@ -146,7 +146,7 @@

## Translators: selected_provider is the name of an external, third-party user authentication service (like Google or LinkedIn). ${_("You've successfully signed in with {selected_provider}.").format(selected_provider='%s' % selected_provider)}
- ${_("Finish your account registration below to start learning.")} + ${_("We just need a little more information before you start learning with edX.")}

% endif From 9219cbdca861b9ecd2961b848c5dc841e9024e5b Mon Sep 17 00:00:00 2001 From: Renzo Lucioni Date: Wed, 3 Sep 2014 10:43:23 -0400 Subject: [PATCH 2/6] Fix 3rd party auth string interpolation, address design feedback --- common/djangoapps/student/views.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 6d5f33758d..dedd2df743 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -884,12 +884,13 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un u'Login failed - user with username {username} has no social auth with backend_name {backend_name}'.format( 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. 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.") + "

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

" + _("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) + + "

" + _("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", status=401 ) From 046b9b156ceb3583267778f74d576b70ecc4176c Mon Sep 17 00:00:00 2001 From: Sarina Canelake Date: Wed, 3 Sep 2014 12:10:24 -0400 Subject: [PATCH 3/6] Fix link in account activation email --- lms/templates/emails/activation_email.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/templates/emails/activation_email.txt b/lms/templates/emails/activation_email.txt index 34704a74cc..a28dfb3365 100644 --- a/lms/templates/emails/activation_email.txt +++ b/lms/templates/emails/activation_email.txt @@ -18,7 +18,7 @@ ${_("Activation ensures that you can register for {platform_name} courses and" " If you require assistance, please use our web form at" " {contact_us} or email {info_address}.").format( platform_name=settings.PLATFORM_NAME, - contact_us=settings.MKTG_URL_LINK_MAP['CONTACT'], + contact_us='https://www.edx.org/contact-us', info_address=settings.CONTACT_EMAIL )} From a703cc8fa8895cdadfda107b43bd9fd200bc0f0c Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 3 Sep 2014 15:51:12 -0400 Subject: [PATCH 4/6] Fix forum nav header width --- lms/static/sass/discussion/elements/_navigation.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/static/sass/discussion/elements/_navigation.scss b/lms/static/sass/discussion/elements/_navigation.scss index 76b33427e9..1eb002911d 100644 --- a/lms/static/sass/discussion/elements/_navigation.scss +++ b/lms/static/sass/discussion/elements/_navigation.scss @@ -17,6 +17,7 @@ @include box-sizing(border-box); display: table; border-bottom: 1px solid $gray-l2; + width: 100%; background-color: $gray-l3; } From d303041c557c3759263dcb13be044d3e51adbaf7 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Wed, 3 Sep 2014 16:13:33 -0400 Subject: [PATCH 5/6] Fix size of endorser username in forum responses --- lms/static/sass/discussion/views/_thread.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lms/static/sass/discussion/views/_thread.scss b/lms/static/sass/discussion/views/_thread.scss index 71a7da7a41..4106cf1378 100644 --- a/lms/static/sass/discussion/views/_thread.scss +++ b/lms/static/sass/discussion/views/_thread.scss @@ -32,6 +32,10 @@ body.discussion, .discussion-module { @extend %t-weight5; } + .posted-details .username { + font-size: inherit; + } + .response-header-content { display: inline-block; vertical-align: top; From 0dea82e43ea609610021e8865ad2890f7da81761 Mon Sep 17 00:00:00 2001 From: Julia Hansbrough Date: Wed, 3 Sep 2014 18:38:53 +0000 Subject: [PATCH 6/6] Analytics should use user.id not anon id --- common/djangoapps/student/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index dedd2df743..49df99d4b5 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -986,7 +986,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un # Track the user's sign in if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'): tracking_context = tracker.get_tracker().resolve_context() - analytics.identify(anonymous_id_for_user(user, None), { + analytics.identify(user.id, { 'email': email, 'username': username, }) @@ -1461,7 +1461,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many # Track the user's registration if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'): tracking_context = tracker.get_tracker().resolve_context() - analytics.identify(anonymous_id_for_user(user, None), { + analytics.identify(user.id, { email: email, username: username, })