From b920a6a1326e6fc0f7d92a52f0c9545c8004764d Mon Sep 17 00:00:00 2001 From: xuans Date: Fri, 25 Sep 2026 23:21:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=96=E8=BE=91=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=97=B6=E5=B7=B2=E4=BF=9D=E5=AD=98=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E4=BB=8D=E8=A2=AB=E8=A6=81=E6=B1=82=E9=87=8D=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/Dashboard/Dashboard.js | 1 + frontend/src/views/Dashboard/Dashboard.test.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/frontend/src/views/Dashboard/Dashboard.js b/frontend/src/views/Dashboard/Dashboard.js index bbff5f0..61a9a5c 100644 --- a/frontend/src/views/Dashboard/Dashboard.js +++ b/frontend/src/views/Dashboard/Dashboard.js @@ -572,6 +572,7 @@ export function useDashboard() { serverEditingId.value = item.id; serverForm.value = { ...item, + passwordConfigured: item.password_configured === true, password: "", validation_command: (item.validation_command || []).join("\n"), reload_command: (item.reload_command || []).join("\n"), diff --git a/frontend/src/views/Dashboard/Dashboard.test.js b/frontend/src/views/Dashboard/Dashboard.test.js index 6ed88d3..a375c7e 100644 --- a/frontend/src/views/Dashboard/Dashboard.test.js +++ b/frontend/src/views/Dashboard/Dashboard.test.js @@ -135,6 +135,20 @@ async function setup(t, request) { return mounted; } +test("编辑服务器正确保留已有密码状态,新建和未配置密码仍要求输入", async (t) => { + const { state } = await setup(t, () => verifiedResponse()); + state.openServerEdit({ id: "configured", auth_method: "password", password_configured: true }); + assert.equal(state.serverForm.value.passwordConfigured, true); + assert.equal(state.serverForm.value.password, ""); + for (const password_configured of [false, undefined]) { + state.openServerEdit({ id: "missing", auth_method: "password", password_configured }); + assert.equal(state.serverForm.value.passwordConfigured, false); + } + state.openServerCreate(); + assert.equal(state.serverForm.value.passwordConfigured, false); + assert.equal(state.serverEditingId.value, ""); +}); + async function fill(state) { state.settingsForm.value.dns.credentials = { access_key_id: "fake-key" }; state.settingsForm.value.dns.test_domain = "example.test";