aboutsummaryrefslogtreecommitdiffstats
path: root/modules/session/store.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/session/store.go')
-rw-r--r--modules/session/store.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/session/store.go b/modules/session/store.go
index 2f7ab7760b..70988fcdc5 100644
--- a/modules/session/store.go
+++ b/modules/session/store.go
@@ -6,9 +6,6 @@ package session
import (
"net/http"
- "code.gitea.io/gitea/modules/setting"
- "code.gitea.io/gitea/modules/web/middleware"
-
"gitea.com/go-chi/session"
)
@@ -21,10 +18,12 @@ type Store interface {
// RegenerateSession regenerates the underlying session and returns the new store
func RegenerateSession(resp http.ResponseWriter, req *http.Request) (Store, error) {
- // Ensure that a cookie with a trailing slash does not take precedence over
- // the cookie written by the middleware.
- middleware.DeleteLegacySiteCookie(resp, setting.SessionConfig.CookieName)
-
+ for _, f := range BeforeRegenerateSession {
+ f(resp, req)
+ }
s, err := session.RegenerateSession(resp, req)
return s, err
}
+
+// BeforeRegenerateSession is a list of functions that are called before a session is regenerated.
+var BeforeRegenerateSession []func(http.ResponseWriter, *http.Request)