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
f3318465
Commit
f3318465
authored
Dec 19, 2017
by
zubair-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move enterprise specific code to separate method "_update_context_error_message_for_enterprise"
parent
e090d557
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
19 deletions
+28
-19
lms/djangoapps/student_account/views.py
+28
-19
No files found.
lms/djangoapps/student_account/views.py
View file @
f3318465
...
@@ -381,27 +381,36 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
...
@@ -381,27 +381,36 @@ def _third_party_auth_context(request, redirect_to, tpa_hint=None):
context
[
'errorMessage'
]
=
_
(
unicode
(
msg
))
# pylint: disable=translation-of-non-string
context
[
'errorMessage'
]
=
_
(
unicode
(
msg
))
# pylint: disable=translation-of-non-string
break
break
if
enterprise_customer
and
context
[
'errorMessage'
]:
context
=
_update_context_for_enterprise_error_message
(
context
,
enterprise_customer
)
context
[
'errorMessage'
]
=
Text
(
_
(
u'We are sorry, you are not authorized to access {platform_name} via this channel. '
return
context
u'Please contact your {enterprise} administrator in order to access {platform_name} '
u'or contact {edx_support_link}.{line_break}'
u'{line_break}'
def
_update_context_for_enterprise_error_message
(
context
,
enterprise_customer
=
None
):
u'Error Details:{line_break}{error_message}'
)
"""
Return updated context with modified `errorMessage` for enterprise.
"""
if
enterprise_customer
and
context
[
'errorMessage'
]:
context
[
'errorMessage'
]
=
Text
(
_
(
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'or contact {edx_support_link}.{line_break}'
u'{line_break}'
u'Error Details:{line_break}{error_message}'
)
)
.
format
(
platform_name
=
configuration_helpers
.
get_value
(
'PLATFORM_NAME'
,
settings
.
PLATFORM_NAME
),
enterprise
=
enterprise_customer
[
'name'
],
error_message
=
context
[
'errorMessage'
],
edx_support_link
=
HTML
(
'<a href="{edx_support_url}">{support_url_name}</a>'
)
.
format
(
)
.
format
(
platform_name
=
configuration_helpers
.
get_value
(
'PLATFORM_NAME'
,
settings
.
PLATFORM_NAME
),
edx_support_url
=
configuration_helpers
.
get_value
(
enterprise
=
enterprise_customer
[
'name'
],
'SUPPORT_SITE_LINK'
,
settings
.
SUPPORT_SITE_LINK
error_message
=
context
[
'errorMessage'
],
edx_support_link
=
HTML
(
'<a href="{edx_support_url}">{support_url_name}</a>'
)
.
format
(
edx_support_url
=
configuration_helpers
.
get_value
(
'SUPPORT_SITE_LINK'
,
settings
.
SUPPORT_SITE_LINK
),
support_url_name
=
_
(
'edX Support'
),
),
),
line_break
=
HTML
(
'<br/>'
)
support_url_name
=
_
(
'edX Support'
),
)
),
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