From aa4b1145eaaaef509a2a1fcc87a11d2a06384de8 Mon Sep 17 00:00:00 2001 From: carey036 <45777074+carey036@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:12:50 +0800 Subject: [PATCH] feat: generate default token after register --- controller/user.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controller/user.go b/controller/user.go index af90acf6..ac63623a 100644 --- a/controller/user.go +++ b/controller/user.go @@ -173,6 +173,18 @@ func Register(c *gin.Context) { }) return } + user.ValidateAndFill() + cleanToken := model.Token{ + UserId: user.Id, + Name: "default", + Key: random.GenerateKey(), + CreatedTime: 0, + AccessedTime: 0, + ExpiredTime: -1, + RemainQuota: -1, + UnlimitedQuota: true, + } + cleanToken.Insert() c.JSON(http.StatusOK, gin.H{ "success": true, "message": "",