Add bio base64 verification
All checks were successful
Build Backend (NixCN CMS) TeamCity build finished
Build Frontend (NixCN CMS) TeamCity build finished

Signed-off-by: Asai Neko <sugar@sne.moe>
This commit is contained in:
2026-01-02 16:56:26 +08:00
parent 61d2d2aef3
commit 8dbdb58327
2 changed files with 28 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package user
import (
"nixcn-cms/data"
"nixcn-cms/internal/cryptography"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
@@ -37,6 +38,13 @@ func Update(c *gin.Context) {
user.Nickname = ReqInfo.Nickname
user.Subtitle = ReqInfo.Subtitle
if ReqInfo.Bio != "" {
if !cryptography.IsBase64Std(ReqInfo.Bio) {
c.JSON(400, gin.H{"status": "invalid base64"})
}
}
user.Bio = ReqInfo.Bio
// Update user info
user.UpdateByUserID(userId)