mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix: fail to modify init user #852
This commit is contained in:
parent
dc0d31ff54
commit
7049599922
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ package user
|
||||||
import (
|
import (
|
||||||
"github.com/0xJacky/Nginx-UI/internal/user"
|
"github.com/0xJacky/Nginx-UI/internal/user"
|
||||||
"github.com/0xJacky/Nginx-UI/model"
|
"github.com/0xJacky/Nginx-UI/model"
|
||||||
|
"github.com/0xJacky/Nginx-UI/settings"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/uozi-tech/cosy"
|
"github.com/uozi-tech/cosy"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
@ -34,7 +35,7 @@ func InitManageUserRouter(g *gin.RouterGroup) {
|
||||||
|
|
||||||
c.ModifyHook(func(c *cosy.Ctx[model.User]) {
|
c.ModifyHook(func(c *cosy.Ctx[model.User]) {
|
||||||
c.BeforeDecodeHook(func(ctx *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)
|
ctx.AbortWithError(user.ErrChangeInitUserPwdInDemo)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue