修复编辑服务器时已保存密码仍被要求重填
This commit is contained in:
parent
c3170291db
commit
b920a6a132
@ -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"),
|
||||
|
||||
@ -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";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user