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
e090d557
Commit
e090d557
authored
Dec 19, 2017
by
zubair-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix quality for xss_lint
parent
9d217f5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
30 deletions
+34
-30
lms/djangoapps/student_account/test/test_views.py
+18
-17
lms/djangoapps/student_account/views.py
+16
-13
No files found.
lms/djangoapps/student_account/test/test_views.py
View file @
e090d557
...
@@ -44,6 +44,7 @@ from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
...
@@ -44,6 +44,7 @@ from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
from
openedx.core.djangoapps.theming.tests.test_util
import
with_comprehensive_theme_context
from
openedx.core.djangoapps.theming.tests.test_util
import
with_comprehensive_theme_context
from
openedx.core.djangoapps.user_api.accounts.api
import
activate_account
,
create_account
from
openedx.core.djangoapps.user_api.accounts.api
import
activate_account
,
create_account
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
openedx.core.djangolib.markup
import
HTML
,
Text
from
openedx.core.djangolib.testing.utils
import
CacheIsolationTestCase
from
openedx.core.djangolib.testing.utils
import
CacheIsolationTestCase
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
student_account.views
import
account_settings_context
,
get_user_orders
from
student_account.views
import
account_settings_context
,
get_user_orders
...
@@ -539,23 +540,23 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
...
@@ -539,23 +540,23 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
with
mock
.
patch
(
'edxmako.request_context.get_current_request'
,
return_value
=
request
):
with
mock
.
patch
(
'edxmako.request_context.get_current_request'
,
return_value
=
request
):
response
=
login_and_registration_form
(
request
)
response
=
login_and_registration_form
(
request
)
expected_
providers
=
[]
expected_
error_message
=
Text
(
_
(
expected_error_message
=
_
(
u'We are sorry, you are not authorized to access {platform_name} via this channel. '
u'
We are sorry, you are not authorized
to access {platform_name} '
u'
Please contact your {enterprise} administrator in order
to access {platform_name} '
u'
via this channel. Please contact your {enterprise} administrator in
'
u'
or contact {edx_support_link}.{line_break}
'
u'
order to access {platform_name} or contact {link_start}edX Support{link_end}.
'
u'
{line_break}
'
u'
{line_break}{line_break}'
u'
Error Details:{line_break}{error_message}'
)
u'Error Details:{line_break}'
)
.
format
(
u'{error_message}'
.
format
(
platform_name
=
settings
.
PLATFORM_NAME
,
platform_name
=
settings
.
PLATFORM_NAME
,
enterprise
=
enterprise_customer_data
[
'name'
]
,
enterprise
=
enterprise_customer_data
[
'name'
]
,
error_message
=
dummy_error_message
,
error_message
=
dummy_error_message
,
edx_support_link
=
HTML
(
link_start
=
'<a href="{edx_support_url}">'
.
format
(
'<a href="{edx_support_url}">{support_url_name}</a>'
edx_support_url
=
settings
.
SUPPORT_SITE_LINK
)
.
format
(
)
,
edx_support_url
=
settings
.
SUPPORT_SITE_LINK
,
link_end
=
'</a>'
,
support_url_name
=
_
(
'edX Support'
)
,
line_break
=
'<br/>'
),
)
line_break
=
HTML
(
'<br/>'
)
)
)
self
.
_assert_saml_auth_data_with_error
(
self
.
_assert_saml_auth_data_with_error
(
response
,
response
,
...
...
lms/djangoapps/student_account/views.py
View file @
e090d557
...
@@ -37,6 +37,7 @@ from openedx.core.djangoapps.user_api.errors import (
...
@@ -37,6 +37,7 @@ from openedx.core.djangoapps.user_api.errors import (
UserNotFound
,
UserNotFound
,
UserAPIInternalError
UserAPIInternalError
)
)
from
openedx.core.djangolib.markup
import
HTML
,
Text
from
openedx.core.lib.edx_api_utils
import
get_edx_api_data
from
openedx.core.lib.edx_api_utils
import
get_edx_api_data
from
openedx.core.lib.time_zone_utils
import
TIME_ZONE_CHOICES
from
openedx.core.lib.time_zone_utils
import
TIME_ZONE_CHOICES
from
openedx.features.enterprise_support.api
import
enterprise_customer_for_request
,
get_enterprise_learner_data
from
openedx.features.enterprise_support.api
import
enterprise_customer_for_request
,
get_enterprise_learner_data
...
@@ -381,23 +382,25 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
...
@@ -381,23 +382,25 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
break
break
if
enterprise_customer
and
context
[
'errorMessage'
]:
if
enterprise_customer
and
context
[
'errorMessage'
]:
context
[
'errorMessage'
]
=
_
(
context
[
'errorMessage'
]
=
Text
(
_
(
u'We are sorry, you are not authorized to access {platform_name} via this channel. '
u'We are sorry, you are not authorized to access {platform_name} via this channel. '
u'Please contact your {enterprise} administrator in order to access {platform_name} '
u'Please contact your {enterprise} administrator in order to access {platform_name} '
u'or contact {
link_start}edX Support{link_end
}.{line_break}'
u'or contact {
edx_support_link
}.{line_break}'
u'{line_break}'
u'{line_break}'
u'Error Details:{line_break}{error_message}'
.
format
(
u'Error Details:{line_break}{error_message}'
)
platform_name
=
configuration_helpers
.
get_value
(
'PLATFORM_NAME'
,
settings
.
PLATFORM_NAME
),
)
.
format
(
enterprise
=
enterprise_customer
[
'name'
],
platform_name
=
configuration_helpers
.
get_value
(
'PLATFORM_NAME'
,
settings
.
PLATFORM_NAME
),
error_message
=
context
[
'errorMessage'
],
enterprise
=
enterprise_customer
[
'name'
],
link_start
=
'<a href="{edx_support_url}">'
.
format
(
error_message
=
context
[
'errorMessage'
],
edx_support_url
=
configuration_helpers
.
get_value
(
edx_support_link
=
HTML
(
'SUPPORT_SITE_LINK'
,
settings
.
SUPPORT_SITE_LINK
'<a href="{edx_support_url}">{support_url_name}</a>'
)
)
.
format
(
edx_support_url
=
configuration_helpers
.
get_value
(
'SUPPORT_SITE_LINK'
,
settings
.
SUPPORT_SITE_LINK
),
),
link_end
=
'</a>'
,
support_url_name
=
_
(
'edX Support'
)
,
line_break
=
'<br/>'
),
)
line_break
=
HTML
(
'<br/>'
)
)
)
return
context
return
context
...
...
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