Commit 578be6cc by Han Su Kim

Merge branch 'release'

parents 07b81446 23d3a918
...@@ -883,13 +883,17 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un ...@@ -883,13 +883,17 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
AUDIT_LOG.warning( AUDIT_LOG.warning(
u'Login failed - user with username {username} has no social auth with backend_name {backend_name}'.format( u'Login failed - user with username {username} has no social auth with backend_name {backend_name}'.format(
username=username, backend_name=backend_name)) username=username, backend_name=backend_name))
return JsonResponse({ return HttpResponseBadRequest(
"success": False, _("You've successfully logged into your {provider_name} account, but this account isn't linked with an {platform_name} account yet.").format(
# Translators: provider_name is the name of an external, third-party user authentication service (like platform_name=settings.PLATFORM_NAME, provider_name=requested_provider.NAME)
# Google or LinkedIn). + "<br/><br/>" + _("Use your {platform_name} username and password to log into {platform_name} below, "
"value": _('There is no {platform_name} account associated with your {provider_name} account. Please use your {platform_name} credentials or pick another provider.').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)
}) # TODO: this should be a status code 401 # pylint: disable=fixme + "<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),
content_type="text/plain",
status=401
)
else: else:
...@@ -982,7 +986,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un ...@@ -982,7 +986,7 @@ def login_user(request, error=""): # pylint: disable-msg=too-many-statements,un
# Track the user's sign in # Track the user's sign in
if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'): if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'):
tracking_context = tracker.get_tracker().resolve_context() tracking_context = tracker.get_tracker().resolve_context()
analytics.identify(anonymous_id_for_user(user, None), { analytics.identify(user.id, {
'email': email, 'email': email,
'username': username, 'username': username,
}) })
...@@ -1457,7 +1461,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many ...@@ -1457,7 +1461,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
# Track the user's registration # Track the user's registration
if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'): if settings.FEATURES.get('SEGMENT_IO_LMS') and hasattr(settings, 'SEGMENT_IO_LMS_KEY'):
tracking_context = tracker.get_tracker().resolve_context() tracking_context = tracker.get_tracker().resolve_context()
analytics.identify(anonymous_id_for_user(user, None), { analytics.identify(user.id, {
email: email, email: email,
username: username, username: username,
}) })
......
...@@ -220,10 +220,8 @@ class IntegrationTest(testutil.TestCase, test.TestCase): ...@@ -220,10 +220,8 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
def assert_json_failure_response_is_missing_social_auth(self, response): def assert_json_failure_response_is_missing_social_auth(self, response):
"""Asserts failure on /login for missing social auth looks right.""" """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. self.assertEqual(401, response.status_code)
payload = json.loads(response.content) self.assertIn("successfully logged into your %s account, but this account isn't linked" % self.PROVIDER_CLASS.NAME, response.content)
self.assertFalse(payload.get('success'))
self.assertIn('associated with your %s account' % self.PROVIDER_CLASS.NAME, payload.get('value'))
def assert_json_failure_response_is_username_collision(self, response): def assert_json_failure_response_is_username_collision(self, response):
"""Asserts the json response indicates a username collision.""" """Asserts the json response indicates a username collision."""
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
@include box-sizing(border-box); @include box-sizing(border-box);
display: table; display: table;
border-bottom: 1px solid $gray-l2; border-bottom: 1px solid $gray-l2;
width: 100%;
background-color: $gray-l3; background-color: $gray-l3;
} }
......
...@@ -32,6 +32,10 @@ body.discussion, .discussion-module { ...@@ -32,6 +32,10 @@ body.discussion, .discussion-module {
@extend %t-weight5; @extend %t-weight5;
} }
.posted-details .username {
font-size: inherit;
}
.response-header-content { .response-header-content {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
......
...@@ -610,6 +610,14 @@ ...@@ -610,6 +610,14 @@
display: block; display: block;
} }
} }
.third-party-signin.message {
display: none;
&.is-shown {
display: block;
}
}
} }
} }
......
...@@ -18,7 +18,7 @@ ${_("Activation ensures that you can register for {platform_name} courses and" ...@@ -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" " If you require assistance, please use our web form at"
" {contact_us} or email {info_address}.").format( " {contact_us} or email {info_address}.").format(
platform_name=settings.PLATFORM_NAME, 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 info_address=settings.CONTACT_EMAIL
)} )}
......
...@@ -46,8 +46,10 @@ ...@@ -46,8 +46,10 @@
toggleSubmitButton(false); toggleSubmitButton(false);
}); });
$('#login-form').on('ajax:error', function() { $('#login-form').on('ajax:error', function(event, request, status_string) {
toggleSubmitButton(true); 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) { $('#login-form').on('ajax:success', function(event, json, xhr) {
...@@ -138,12 +140,16 @@ ...@@ -138,12 +140,16 @@
</div> </div>
<div role="alert" class="status message submission-error" tabindex="-1"> <div role="alert" class="status message submission-error" tabindex="-1">
<h3 class="message-title">${_("The following errors occurred while logging you in:")} </h3> <h3 class="message-title">${_("We couldn't log you in.")} </h3>
<ul class="message-copy"> <ul class="message-copy">
<li>${_("Your email or password is incorrect")}</li> <li>${_("Your email or password is incorrect")}</li>
</ul> </ul>
</div> </div>
<div role="alert" class="third-party-signin message" tabindex="-1">
<p class="instructions"> </p>
</div>
<p class="instructions sr"> <p class="instructions sr">
${_('Please provide the following information to log into your {platform_name} account. Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>.').format(platform_name=platform_name)} ${_('Please provide the following information to log into your {platform_name} account. Required fields are noted by <strong class="indicator">bold text and an asterisk (*)</strong>.').format(platform_name=platform_name)}
</p> </p>
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
<p class="instructions"> <p class="instructions">
## Translators: selected_provider is the name of an external, third-party user authentication service (like Google or LinkedIn). ## 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='<strong>%s</strong>' % selected_provider)}<br /> ${_("You've successfully signed in with {selected_provider}.").format(selected_provider='<strong>%s</strong>' % selected_provider)}<br />
${_("Finish your account registration below to start learning.")} ${_("We just need a little more information before you start learning with edX.")}
</p> </p>
% endif % endif
......
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