From b0929a3de6974beb14ae8049adc0432a6e6789f1 Mon Sep 17 00:00:00 2001 From: jinjianming <57084209+jinjianming@users.noreply.github.com> Date: Thu, 6 Jun 2024 20:50:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgit=E3=80=81=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E7=AD=89=E7=94=A8=E6=88=B7=E6=B3=A8=E5=86=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E5=88=9B=E5=BB=BA=E9=BB=98=E8=AE=A4=E4=BB=A4=E7=89=8C?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除普通用户注册代码 --- controller/user.go | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/controller/user.go b/controller/user.go index 9ab37b5a..e79881c2 100644 --- a/controller/user.go +++ b/controller/user.go @@ -6,8 +6,6 @@ import ( "github.com/songquanpeng/one-api/common" "github.com/songquanpeng/one-api/common/config" "github.com/songquanpeng/one-api/common/ctxkey" - "github.com/songquanpeng/one-api/common/helper" - "github.com/songquanpeng/one-api/common/logger" "github.com/songquanpeng/one-api/common/random" "github.com/songquanpeng/one-api/model" "net/http" @@ -111,7 +109,6 @@ func Logout(c *gin.Context) { } func Register(c *gin.Context) { - ctx := c.Request.Context() if !config.RegisterEnabled { c.JSON(http.StatusOK, gin.H{ "message": "管理员关闭了新用户注册", @@ -176,28 +173,7 @@ func Register(c *gin.Context) { }) return } - go func() { - err := user.ValidateAndFill() - if err != nil { - logger.Errorf(ctx, "user.ValidateAndFill failed: %w", err) - return - } - cleanToken := model.Token{ - UserId: user.Id, - Name: "default", - Key: random.GenerateKey(), - CreatedTime: helper.GetTimestamp(), - AccessedTime: helper.GetTimestamp(), - ExpiredTime: -1, - RemainQuota: -1, - UnlimitedQuota: true, - } - err = cleanToken.Insert() - if err != nil { - logger.Errorf(ctx, "cleanToken.Insert failed: %w", err) - return - } - }() + c.JSON(http.StatusOK, gin.H{ "success": true, "message": "",