This commit is contained in:
MHSanaei
2026-04-20 20:03:40 +02:00
parent ca2fd3814f
commit a9d8905393
2 changed files with 6 additions and 3 deletions

View File

@@ -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,