MHSanaei 5 ngày trước cách đây
mục cha
commit
a9d8905393
2 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 1 1
      config/version
  2. 5 2
      web/session/session.go

+ 1 - 1
config/version

@@ -1 +1 @@
-2.8.11
+2.9.0

+ 5 - 2
web/session/session.go

@@ -14,7 +14,6 @@ import (
 
 const (
 	loginUserKey = "LOGIN_USER"
-	defaultPath  = "/"
 )
 
 func init() {
@@ -59,8 +58,12 @@ func IsLogin(c *gin.Context) bool {
 func ClearSession(c *gin.Context) {
 	s := sessions.Default(c)
 	s.Clear()
+	cookiePath := c.GetString("base_path")
+	if cookiePath == "" {
+		cookiePath = "/"
+	}
 	s.Options(sessions.Options{
-		Path:     defaultPath,
+		Path:     cookiePath,
 		MaxAge:   -1,
 		HttpOnly: true,
 		SameSite: http.SameSiteLaxMode,