Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kulya
OpnSense
Commits
0a6fbdd8
Commit
0a6fbdd8
authored
Mar 08, 2017
by
Fabian Franz
Committed by
Franco Fichtner
Mar 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make csrf error page translateable, fix HTML errors in csrf
(cherry picked from commit
2407fa01
)
parent
6efcb135
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
csrf.inc
src/www/csrf.inc
+9
-8
No files found.
src/www/csrf.inc
View file @
0a6fbdd8
...
...
@@ -90,7 +90,7 @@ class LegacyCSRF
}
if
(
$this
->
is_html_output
)
{
$csrf
=
$this
->
newToken
();
$inputtag
=
"<input type=
\"
hidden
\"
id=
\"
__opnsense_csrf
\"
name=
\"
{
$csrf
[
'key'
]
}
\"
value=
\"
{
$csrf
[
'token'
]
}
\"
\
/>"
;
$inputtag
=
"<input type=
\"
hidden
\"
id=
\"
__opnsense_csrf
\"
name=
\"
{
$csrf
[
'key'
]
}
\"
value=
\"
{
$csrf
[
'token'
]
}
\"
/>"
;
$buffer
=
preg_replace
(
'#(<form[^>]*method\s*=\s*["\']post["\'][^>]*>)#i'
,
'$1'
.
$inputtag
,
$buffer
);
// csrf token for Ajax type requests
$script
=
"
...
...
@@ -104,7 +104,7 @@ class LegacyCSRF
});
</script>
"
;
$buffer
=
str_ireplace
(
'</head>'
,
'</head>'
.
$script
,
$buffer
);
$buffer
=
str_ireplace
(
'</head>'
,
$script
.
'</head>'
,
$buffer
);
}
return
$buffer
;
}
...
...
@@ -114,11 +114,12 @@ $LegacyCSRFObject = new LegacyCSRF();
if
(
$_SERVER
[
'REQUEST_METHOD'
]
!==
'GET'
&&
!
$LegacyCSRFObject
->
checkToken
())
{
header
(
$_SERVER
[
'SERVER_PROTOCOL'
]
.
' 403 Forbidden'
);
echo
"<html><head><title>CSRF check failed
</title></head>
echo
sprintf
(
"<html><head><title>%s
</title></head>
<body>
<p>CSRF check failed. Your form session may have expired, or you may not have
cookies enabled.</p>
</body></html>
"
;
<p>%s</p>
</body></html>"
,
gettext
(
'CSRF check failed'
),
gettext
(
'CSRF check failed. Your form session may have expired, or you may not have cookies enabled.'
)
);
die
;
}
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