浏览代码

fix: fail to modify init user #852

Jacky 5 月之前
父节点
当前提交
7049599922
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      api/user/user.go

+ 2 - 1
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)
 			}
 		})