Skip to content

Commit

Permalink
fix: fail to modify init user #852
Browse files Browse the repository at this point in the history
  • Loading branch information
0xJacky committed Feb 6, 2025
1 parent dc0d31f commit 7049599
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
})
Expand Down

0 comments on commit 7049599

Please sign in to comment.