fix(auth): 修复历史分销用户登录后立即退出
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
smsprovider "hfb_sys/backend/internal/integrations/sms"
|
||||
"hfb_sys/backend/internal/logging"
|
||||
"hfb_sys/backend/internal/model"
|
||||
"hfb_sys/backend/internal/sitecode"
|
||||
"hfb_sys/backend/internal/tenancy"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
@@ -260,7 +261,9 @@ func (s *Service) RefreshToken(ctx context.Context, refreshToken string) (TokenP
|
||||
}
|
||||
tenantID := tenancy.IDFromContext(ctx)
|
||||
if claims.TenantID > 0 && claims.TenantID != tenantID {
|
||||
return TokenPair{}, ErrTokenVersionMismatch
|
||||
if tenantID != 0 || sitecode.BoundSiteCodeFromContext(ctx) == "" {
|
||||
return TokenPair{}, ErrTokenVersionMismatch
|
||||
}
|
||||
}
|
||||
user, err := s.users.FindActiveForToken(ctx, claims.UserID, claims.TokenVersion)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user