fix(pve): Password字段JSON tag为-导致前端密码无法传入

- models.go: PVEHost.Password json tag "-" -> "password",
  否则c.ShouldBindJSON无法绑定前端传的password字段
- handlers/pve.go: 返回前清空Password字段防止泄露

[金渐层/K2.6-code-preview🐾]
This commit is contained in:
openclaw
2026-04-20 13:32:24 +08:00
parent 1fcf9cbdef
commit 2507dc8f02
2 changed files with 3 additions and 1 deletions

View File

@@ -67,6 +67,7 @@ func (h *PVEHandler) Get(c *gin.Context) {
}
host.PasswordEnc = ""
host.Password = ""
c.JSON(http.StatusOK, host)
}
@@ -98,6 +99,7 @@ func (h *PVEHandler) Create(c *gin.Context) {
}
host.PasswordEnc = ""
host.Password = ""
c.JSON(http.StatusCreated, host)
}

View File

@@ -142,7 +142,7 @@ type PVEHost struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// 运行时使用,不存储
Password string `json:"-"`
Password string `json:"password"`
}
type PVEVMStatus struct {