Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
18474b2d
Commit
18474b2d
authored
Apr 14, 2016
by
Adam Palay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raise 404 if non-int user is passed to cert view
parent
883712b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
lms/djangoapps/certificates/tests/test_webview_views.py
+10
-0
lms/djangoapps/certificates/views/webview.py
+5
-0
No files found.
lms/djangoapps/certificates/tests/test_webview_views.py
View file @
18474b2d
...
...
@@ -695,6 +695,16 @@ class CertificatesViewsTests(ModuleStoreTestCase, EventTrackingTestCase):
self
.
assertIn
(
'invalid'
,
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_render_html_view_non_int_user
(
self
):
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
0
)
test_url
=
get_certificate_url
(
user_id
=
"Good tests make good neighbors"
,
course_id
=
unicode
(
self
.
course
.
id
)
)
response
=
self
.
client
.
get
(
test_url
)
self
.
assertEqual
(
response
.
status_code
,
404
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_render_html_view_invalid_user_certificate
(
self
):
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
0
)
test_url
=
get_certificate_url
(
...
...
lms/djangoapps/certificates/views/webview.py
View file @
18474b2d
...
...
@@ -496,6 +496,11 @@ def render_html_view(request, user_id, course_id):
This public view generates an HTML representation of the specified user and course
If a certificate is not available, we display a "Sorry!" screen instead
"""
try
:
user_id
=
int
(
user_id
)
except
ValueError
:
raise
Http404
preview_mode
=
request
.
GET
.
get
(
'preview'
,
None
)
platform_name
=
microsite
.
get_value
(
"platform_name"
,
settings
.
PLATFORM_NAME
)
configuration
=
CertificateHtmlViewConfiguration
.
get_config
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment