fix(admin): 编辑停用用户时清除全部登录会话 (#686)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Catlaxy AI
2026-10-06 09:23:46 +08:00
committed by GitHub
parent fd692634d6
commit 2b9ce566e7
2 changed files with 77 additions and 0 deletions

View File

@@ -238,6 +238,11 @@ func (s *Service) UpdateUser(actor *model.User, userID string, req UpdateUserReq
return nil, fmt.Errorf("清理旧登录会话失败,密码未更新:%w", err)
}
}
if nextStatus == model.UserStatusDisabled {
if err := s.repo.DeleteUserAuthSessions(user.ID); err != nil {
return nil, err
}
}
user.Role = nextRole
user.Status = nextStatus
user.UpdatedAt = time.Now()