修复编辑服务器时已保存密码仍被要求重填
This commit is contained in:
1 parent
c3170291db
commit
b920a6a132
2 files changed
+15
No files matched your search
@@ -572,6 +572,7 @@ export function useDashboard() {
|
|||||||
serverEditingId.value = item.id;
|
serverEditingId.value = item.id;
|
||||||
serverForm.value = {
|
serverForm.value = {
|
||||||
...item,
|
...item,
|
||||||
|
passwordConfigured: item.password_configured === true,
|
||||||
password: "",
|
password: "",
|
||||||
validation_command: (item.validation_command || []).join("\n"),
|
validation_command: (item.validation_command || []).join("\n"),
|
||||||
reload_command: (item.reload_command || []).join("\n"),
|
reload_command: (item.reload_command || []).join("\n"),
|
||||||
|
|||||||
@@ -135,6 +135,20 @@ async function setup(t, request) {
|
|||||||
return mounted;
|
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) {
|
async function fill(state) {
|
||||||
state.settingsForm.value.dns.credentials = { access_key_id: "fake-key" };
|
state.settingsForm.value.dns.credentials = { access_key_id: "fake-key" };
|
||||||
state.settingsForm.value.dns.test_domain = "example.test";
|
state.settingsForm.value.dns.test_domain = "example.test";
|
||||||
|
|||||||
Reference in new issue
Block a user