From 70495999223c0f437be41aa7d69ace5480342f4d Mon Sep 17 00:00:00 2001 From: Jacky Date: Thu, 6 Feb 2025 18:03:46 +0800 Subject: [PATCH] fix: fail to modify init user #852 --- api/user/user.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/user/user.go b/api/user/user.go index 7f8d7921..d36d8c3e 100644 --- a/api/user/user.go +++ b/api/user/user.go @@ -3,6 +3,7 @@ package user import ( "github.com/0xJacky/Nginx-UI/internal/user" "github.com/0xJacky/Nginx-UI/model" + "github.com/0xJacky/Nginx-UI/settings" "github.com/gin-gonic/gin" "github.com/uozi-tech/cosy" "golang.org/x/crypto/bcrypt" @@ -34,7 +35,7 @@ func InitManageUserRouter(g *gin.RouterGroup) { c.ModifyHook(func(c *cosy.Ctx[model.User]) { c.BeforeDecodeHook(func(ctx *cosy.Ctx[model.User]) { - if ctx.ID == 1 { + if settings.NodeSettings.Demo && ctx.ID == 1 { ctx.AbortWithError(user.ErrChangeInitUserPwdInDemo) } })