From 985895de976e0a6571a3c9e217ec735dc3b24d6f Mon Sep 17 00:00:00 2001 From: yang fan Date: Thu, 10 Aug 2023 14:01:58 +0000 Subject: [PATCH] fork --- controller/token.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controller/token.go b/controller/token.go index 5341ea3a..3de98065 100644 --- a/controller/token.go +++ b/controller/token.go @@ -171,6 +171,13 @@ func UpdateToken(c *gin.Context) { }) return } + if len(token.Name) == 0 || len(token.Name) > 20 { + c.JSON(http.StatusOK, gin.H{ + "success": false, + "message": "令牌名称长度必须在1-20之间", + }) + return + } cleanToken, err := model.GetTokenByIds(token.Id, userId) if err != nil { c.JSON(http.StatusOK, gin.H{