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
59e184a8
Commit
59e184a8
authored
Jul 14, 2015
by
Vedran Karačić
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8854 from edx/vkaracic/TNL-394
TNL-394: Added sanitization of id names
parents
f9cb0924
3ec3cf64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
lms/static/js/spec/staff_debug_actions_spec.js
+6
-0
lms/static/js/staff_debug_actions.js
+7
-1
No files found.
lms/static/js/spec/staff_debug_actions_spec.js
View file @
59e184a8
...
...
@@ -14,6 +14,12 @@ define(['backbone', 'jquery', 'js/staff_debug_actions'],
});
});
describe
(
'sanitize_string'
,
function
()
{
it
(
'escapes escapable characters in a string'
,
function
()
{
expect
(
StaffDebug
.
sanitized_string
(
'.*+?^:${}()|]['
)).
toBe
(
'
\\
.
\\
*
\\
+
\\
?
\\
^
\\
:
\\
$
\\
{
\\
}
\\
(
\\
)
\\
|
\\
]
\\
['
);
});
});
describe
(
'get_user'
,
function
()
{
it
(
'gets the placeholder username if input field is empty'
,
function
()
{
...
...
lms/static/js/staff_debug_actions.js
View file @
59e184a8
...
...
@@ -11,7 +11,12 @@ var StaffDebug = (function(){
return
url
;
}
sanitized_string
=
function
(
string
)
{
return
string
.
replace
(
/
[
.*+?^:${}()|[
\]\\]
/g
,
"
\\
$&"
);
}
get_user
=
function
(
locname
){
locname
=
sanitized_string
(
locname
);
var
uname
=
$
(
'#sd_fu_'
+
locname
).
val
();
if
(
uname
==
""
){
uname
=
$
(
'#sd_fu_'
+
locname
).
attr
(
'placeholder'
);
...
...
@@ -108,7 +113,8 @@ var StaffDebug = (function(){
do_idash_action
:
do_idash_action
,
get_current_url
:
get_current_url
,
get_url
:
get_url
,
get_user
:
get_user
get_user
:
get_user
,
sanitized_string
:
sanitized_string
}
})();
...
...
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