Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
UlricQin committed Apr 2, 2021
1 parent 3cf930f commit e5c283d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions csrf.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,14 @@ func Middleware(options Options) gin.HandlerFunc {
}

return func(c *gin.Context) {
session := sessions.Default(c)
c.Set(csrfSecret, options.Secret)

if inArray(ignoreMethods, c.Request.Method) {
c.Next()
return
}

// if len(c.Request.Header.Get("X-User-Token")) > 0 {
// c.Next()
// return
// }

session := sessions.Default(c)
c.Set(csrfSecret, options.Secret)

salt, ok := session.Get(csrfSalt).(string)

if !ok || len(salt) == 0 {
Expand Down

0 comments on commit e5c283d

Please sign in to comment.