Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
054fa85f
Unverified
Commit
054fa85f
authored
5 years ago
by
Robert Raposa
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #22452 from edx/robrap/ARCH-1253-login-cleanup-part-2
ARCH-1253: return json for third party auth failure
parents
cf961828
ebcff3fb
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/user_authn/views/login.py
+5
-1
5 additions, 1 deletion
openedx/core/djangoapps/user_authn/views/login.py
openedx/core/djangoapps/user_authn/views/tests/test_login.py
+7
-1
7 additions, 1 deletion
openedx/core/djangoapps/user_authn/views/tests/test_login.py
with
12 additions
and
2 deletions
openedx/core/djangoapps/user_authn/views/login.py
+
5
−
1
View file @
054fa85f
...
...
@@ -365,7 +365,11 @@ def login_user(request):
except
AuthFailedError
as
e
:
set_custom_metric
(
'
login_user_tpa_success
'
,
False
)
set_custom_metric
(
'
login_user_tpa_failure_msg
'
,
e
.
value
)
return
HttpResponse
(
e
.
value
,
content_type
=
"
text/plain
"
,
status
=
403
)
# user successfully authenticated with a third party provider, but has no linked Open edX account
response_content
=
e
.
get_response
()
response_content
[
'
error_code
'
]
=
'
third-party-auth-with-no-linked-account
'
return
JsonResponse
(
response_content
,
status
=
403
)
else
:
user
=
_get_user_by_email
(
request
)
...
...
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/user_authn/views/tests/test_login.py
+
7
−
1
View file @
054fa85f
...
...
@@ -40,6 +40,7 @@ from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_un
from
openedx.core.djangoapps.site_configuration.tests.mixins
import
SiteMixin
from
openedx.core.lib.api.test_utils
import
ApiTestCase
from
student.tests.factories
import
RegistrationFactory
,
UserFactory
,
UserProfileFactory
from
util.json_request
import
JsonResponse
from
util.password_policy_validators
import
DEFAULT_MAX_PASSWORD_LENGTH
...
...
@@ -818,8 +819,13 @@ class StudentViewShimTest(TestCase):
self
.
captured_request
=
None
def
test_third_party_auth_login_failure
(
self
):
mocked_response_content
=
{
"
success
"
:
False
,
"
error_code
"
:
"
third-party-auth-with-no-linked-account
"
,
"
value
"
:
"
Test message.
"
}
view
=
self
.
_shimmed_view
(
Http
Response
(
status
=
403
),
Json
Response
(
mocked_response_content
,
status
=
403
),
check_logged_in
=
True
)
response
=
view
(
HttpRequest
())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment