完善已配置DNS账户编辑校验

补充编辑凭据前的权限与版本校验,完善名称编辑提示,并增加凭据替换、验证状态和越权写入回归测试。
This commit is contained in:
xuans committed 2026-10-16 00:22:26 +08:00
1 parent 4aca34c16d
commit 423a674949
4 files changed
+22 -2

No files matched your search

@@ -105,7 +105,9 @@ export function useDNSAccountEditor(projects, providers, loading, refresh) {
body: JSON.stringify(body),
});
if (!mounted) return;
notice.value = ["create", "edit", "rotate"].includes(form.action)
const credentialChanged = Boolean(body.credentials);
notice.value = ["create", "rotate"].includes(form.action)
|| (form.action === "edit" && credentialChanged)
? "账户已保存,请使用有权管理的测试域名执行在线验证" : "账户操作已完成";
} catch (reason) {
if (!mounted) return;
@@ -90,6 +90,7 @@ test("编辑账户时凭据留空表示保留原配置", async (t) => {
await state.saveEditor();
const write = calls.find((item) => item.method);
assert.deepEqual(JSON.parse(write.body), { revision: 7, name: "仅修改名称" });
assert.equal(state.notice.value, "账户操作已完成");
});
test("只读项目和历史配置不能发起账户写操作", async (t) => {