Correct 3rd party auth login page message and styling
This commit is contained in:
@@ -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.") + "<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, provider_name=requested_provider.NAME),
|
||||
content_type="text/plain",
|
||||
status=401
|
||||
)
|
||||
|
||||
else:
|
||||
|
||||
|
||||
@@ -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."""
|
||||
|
||||
Reference in New Issue
Block a user