feat: 优化key验证流程
This commit is contained in:
@@ -201,11 +201,17 @@ func (s *Server) TestMultipleKeys(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
group, ok := s.findGroupByID(c, req.GroupID)
|
||||
groupDB, ok := s.findGroupByID(c, req.GroupID)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
group, err := s.GroupManager.GetGroupByName(groupDB.Name)
|
||||
if err != nil {
|
||||
response.Error(c, app_errors.NewAPIError(app_errors.ErrResourceNotFound, fmt.Sprintf("Group '%s' not found", groupDB.Name)))
|
||||
return
|
||||
}
|
||||
|
||||
if err := validateKeysText(req.KeysText); err != nil {
|
||||
response.Error(c, app_errors.NewAPIError(app_errors.ErrValidation, err.Error()))
|
||||
return
|
||||
@@ -234,11 +240,17 @@ func (s *Server) ValidateGroupKeys(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
group, ok := s.findGroupByID(c, req.GroupID)
|
||||
groupDB, ok := s.findGroupByID(c, req.GroupID)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
group, err := s.GroupManager.GetGroupByName(groupDB.Name)
|
||||
if err != nil {
|
||||
response.Error(c, app_errors.NewAPIError(app_errors.ErrResourceNotFound, fmt.Sprintf("Group '%s' not found", groupDB.Name)))
|
||||
return
|
||||
}
|
||||
|
||||
taskStatus, err := s.KeyManualValidationService.StartValidationTask(group)
|
||||
if err != nil {
|
||||
response.Error(c, app_errors.NewAPIError(app_errors.ErrTaskInProgress, err.Error()))
|
||||
|
Reference in New Issue
Block a user