fix(auth): 修复历史分销用户登录后立即退出
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"hfb_sys/backend/internal/logging"
|
||||
"hfb_sys/backend/internal/modules/auth"
|
||||
"hfb_sys/backend/internal/sitecode"
|
||||
"hfb_sys/backend/internal/tenancy"
|
||||
"hfb_sys/backend/pkg/response"
|
||||
|
||||
@@ -217,7 +218,11 @@ func userTokenTenantMatches(c *gin.Context, tokenTenantID uint64) bool {
|
||||
if tokenTenantID == 0 {
|
||||
return true
|
||||
}
|
||||
return requestTenantID > 0 && requestTenantID == tokenTenantID
|
||||
if requestTenantID > 0 {
|
||||
return requestTenantID == tokenTenantID
|
||||
}
|
||||
// 历史分销用户的 tenant_id 可能仍指向大锤,具体归属由令牌校验时的站点过滤确认。
|
||||
return sitecode.BoundSiteCodeFromContext(c.Request.Context()) != ""
|
||||
}
|
||||
|
||||
func AdminAuth(jwtManager *auth.JWTManager, validate AdminTokenValidatorFunc) gin.HandlerFunc {
|
||||
|
||||
Reference in New Issue
Block a user