diff --git a/service/admin/user.go b/service/admin/user.go index 0b66deb50a..eb76ac9aca 100644 --- a/service/admin/user.go +++ b/service/admin/user.go @@ -112,8 +112,13 @@ func (service *AddUserService) Add() serializer.Response { user.TwoFactor = service.User.TwoFactor // 检查愚蠢操作 - if user.ID == 1 && user.GroupID != 1 { - return serializer.Err(serializer.CodeChangeGroupForDefaultUser, "", nil) + if user.ID == 1 { + if user.GroupID != 1 { + return serializer.Err(serializer.CodeChangeGroupForDefaultUser, "", nil) + } + if user.Status != model.Active { + return serializer.Err(serializer.CodeInvalidActionOnDefaultUser, "", nil) + } } if err := model.DB.Save(&user).Error; err != nil {