Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
f0b95c55
Commit
f0b95c55
authored
May 19, 2017
by
astaxie
Committed by
GitHub
May 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2315 from sch00lb0y/master
issue no:#2261 fix for xsrf panic error
parents
720c323e
ce677202
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
error.go
error.go
+24
-0
hooks.go
hooks.go
+2
-0
No files found.
error.go
View file @
f0b95c55
...
...
@@ -252,6 +252,30 @@ func forbidden(rw http.ResponseWriter, r *http.Request) {
)
}
// show 422 missing xsrf token
func
missingxsrf
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseError
(
rw
,
r
,
422
,
"<br>The page you have requested is forbidden."
+
"<br>Perhaps you are here because:"
+
"<br><br><ul>"
+
"<br>'_xsrf' argument missing from POST"
+
"</ul>"
,
)
}
// show 417 invalid xsrf token
func
invalidxsrf
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseError
(
rw
,
r
,
417
,
"<br>The page you have requested is forbidden."
+
"<br>Perhaps you are here because:"
+
"<br><br><ul>"
+
"<br>expected XSRF not found"
+
"</ul>"
,
)
}
// show 404 not found error.
func
notFound
(
rw
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
responseError
(
rw
,
r
,
...
...
hooks.go
View file @
f0b95c55
...
...
@@ -32,6 +32,8 @@ func registerDefaultErrorHandler() error {
"502"
:
badGateway
,
"503"
:
serviceUnavailable
,
"504"
:
gatewayTimeout
,
"417"
:
invalidxsrf
,
"422"
:
missingxsrf
,
}
for
e
,
h
:=
range
m
{
if
_
,
ok
:=
ErrorMaps
[
e
];
!
ok
{
...
...
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