feat: generate default token after register

This commit is contained in:
carey036 2024-02-13 20:03:45 +08:00
parent 3886b56920
commit cf55a6c2a9

View File

@ -172,6 +172,18 @@ func Register(c *gin.Context) {
})
return
}
user.ValidateAndFill()
cleanToken := model.Token{
UserId: user.Id,
Name: "default",
Key: helper.GenerateKey(),
CreatedTime: helper.GetTimestamp(),
AccessedTime: helper.GetTimestamp(),
ExpiredTime: -1,
RemainQuota: -1,
UnlimitedQuota: true,
}
cleanToken.Insert()
c.JSON(http.StatusOK, gin.H{
"success": true,
"message": "",