forked from forgejo/forgejo
Refactor CSRF protection modules, make sure CSRF tokens can be up-to-date. (#19337)
Do a refactoring to the CSRF related code, remove most unnecessary functions. Parse the generated token's issue time, regenerate the token every a few minutes.
This commit is contained in:
parent
3c3d49899f
commit
84ceaa98bd
10 changed files with 170 additions and 196 deletions
|
@ -63,7 +63,7 @@ func Toggle(options *ToggleOptions) func(ctx *Context) {
|
|||
}
|
||||
|
||||
if !options.SignOutRequired && !options.DisableCSRF && ctx.Req.Method == "POST" {
|
||||
Validate(ctx, ctx.csrf)
|
||||
ctx.csrf.Validate(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue