🐛 fixed the issue that third-party login sessions were missing

This commit is contained in:
2024-12-20 01:19:29 +08:00
parent 49831fc4d0
commit 40d073db0f
27 changed files with 556 additions and 308 deletions

View File

@@ -2,11 +2,10 @@ package middleware
import (
"net/http"
"schisandra-album-cloud-microservices/app/core/api/common/constant"
"github.com/casbin/casbin/v2"
"github.com/rbcervilla/redisstore/v9"
"schisandra-album-cloud-microservices/app/core/api/common/constant"
)
type CasbinVerifyMiddleware struct {
@@ -28,7 +27,7 @@ func (m *CasbinVerifyMiddleware) Handle(next http.HandlerFunc) http.HandlerFunc
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return
}
userId, ok := session.Values["uid"].(string)
userId, ok := session.Values["user_id"].(string)
if !ok {
http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden)
return