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
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
d9bd1c3f
Commit
d9bd1c3f
authored
4 years ago
by
Bianca Severino
Browse files
Options
Downloads
Patches
Plain Diff
Add logging for 400 errors when submitting IDV photos
parent
84930bd5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/verify_student/views.py
+17
-5
17 additions, 5 deletions
lms/djangoapps/verify_student/views.py
with
17 additions
and
5 deletions
lms/djangoapps/verify_student/views.py
+
17
−
5
View file @
d9bd1c3f
...
...
@@ -837,6 +837,8 @@ class SubmitPhotosView(View):
checkpoint (str): Location of the checkpoint in the course.
"""
log
.
info
((
u
"
User {user_id} is submitting photos for ID verification
"
).
format
(
user_id
=
request
.
user
.
id
))
# If the user already has an initial verification attempt, we can re-use the photo ID
# the user submitted with the initial attempt.
initial_verification
=
SoftwareSecurePhotoVerification
.
get_initial_verification
(
request
.
user
)
...
...
@@ -848,7 +850,7 @@ class SubmitPhotosView(View):
# If necessary, update the user's full name
if
"
full_name
"
in
params
:
response
=
self
.
_update_full_name
(
request
.
user
,
params
[
"
full_name
"
])
response
=
self
.
_update_full_name
(
request
,
params
[
"
full_name
"
])
if
response
is
not
None
:
return
response
...
...
@@ -856,7 +858,7 @@ class SubmitPhotosView(View):
# Validation ensures that we'll have a face image, but we may not have
# a photo ID image if this is a re-verification.
face_image
,
photo_id_image
,
response
=
self
.
_decode_image_data
(
params
[
"
face_image
"
],
params
.
get
(
"
photo_id_image
"
)
request
,
params
[
"
face_image
"
],
params
.
get
(
"
photo_id_image
"
)
)
# If we have a photo_id we do not want use the initial verification image.
...
...
@@ -918,6 +920,7 @@ class SubmitPhotosView(View):
# The face image is always required.
if
"
face_image
"
not
in
params
:
msg
=
_
(
"
Missing required parameter face_image
"
)
log
.
error
((
u
"
User {user_id} missing required parameter face_image
"
).
format
(
user_id
=
request
.
user
.
id
))
return
None
,
HttpResponseBadRequest
(
msg
)
# If provided, parse the course key and checkpoint location
...
...
@@ -925,11 +928,12 @@ class SubmitPhotosView(View):
try
:
params
[
"
course_key
"
]
=
CourseKey
.
from_string
(
params
[
"
course_key
"
])
except
InvalidKeyError
:
log
.
error
((
u
"
User {user_id} provided invalid course_key
"
).
format
(
user_id
=
request
.
user
.
id
))
return
None
,
HttpResponseBadRequest
(
_
(
"
Invalid course key
"
))
return
params
,
None
def
_update_full_name
(
self
,
user
,
full_name
):
def
_update_full_name
(
self
,
request
,
full_name
):
"""
Update the user
'
s full name.
...
...
@@ -942,16 +946,23 @@ class SubmitPhotosView(View):
"""
try
:
update_account_settings
(
user
,
{
"
name
"
:
full_name
})
update_account_settings
(
request
.
user
,
{
"
name
"
:
full_name
})
except
UserNotFound
:
log
.
error
((
u
"
No profile found for user {user_id}
"
).
format
(
user_id
=
request
.
user
.
id
))
return
HttpResponseBadRequest
(
_
(
"
No profile found for user
"
))
except
AccountValidationError
:
msg
=
_
(
u
"
Name must be at least {min_length} character long.
"
).
format
(
min_length
=
NAME_MIN_LENGTH
)
log
.
error
(
(
u
"
User {user_id} provided an account name less than {min_length} characters
"
).
format
(
user_id
=
request
.
user
.
id
,
min_length
=
NAME_MIN_LENGTH
)
)
return
HttpResponseBadRequest
(
msg
)
def
_decode_image_data
(
self
,
face_data
,
photo_id_data
=
None
):
def
_decode_image_data
(
self
,
request
,
face_data
,
photo_id_data
=
None
):
"""
Decode image data sent with the request.
...
...
@@ -979,6 +990,7 @@ class SubmitPhotosView(View):
except
InvalidImageData
:
msg
=
_
(
"
Image data is not valid.
"
)
log
.
error
((
u
"
Image data for user {user_id} is not valid
"
).
format
(
user_id
=
request
.
user
.
id
))
return
None
,
None
,
HttpResponseBadRequest
(
msg
)
def
_submit_attempt
(
self
,
user
,
face_image
,
photo_id_image
=
None
,
initial_verification
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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