Skip to content

Commit 7049599

Browse files
committed
fix: fail to modify init user #852
1 parent dc0d31f commit 7049599

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/user/user.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package user
33
import (
44
"github.com/0xJacky/Nginx-UI/internal/user"
55
"github.com/0xJacky/Nginx-UI/model"
6+
"github.com/0xJacky/Nginx-UI/settings"
67
"github.com/gin-gonic/gin"
78
"github.com/uozi-tech/cosy"
89
"golang.org/x/crypto/bcrypt"
@@ -34,7 +35,7 @@ func InitManageUserRouter(g *gin.RouterGroup) {
3435

3536
c.ModifyHook(func(c *cosy.Ctx[model.User]) {
3637
c.BeforeDecodeHook(func(ctx *cosy.Ctx[model.User]) {
37-
if ctx.ID == 1 {
38+
if settings.NodeSettings.Demo && ctx.ID == 1 {
3839
ctx.AbortWithError(user.ErrChangeInitUserPwdInDemo)
3940
}
4041
})

0 commit comments

Comments
 (0)