保存部署服务器密码认证支持与页面改造前检查点

This commit is contained in:
xuans committed 2026-09-25 13:28:47 +08:00
1 parent 24b9e7abdc
commit be6bc63102
10 files changed
+186 -49

No files matched your search

@@ -336,7 +336,10 @@ export function useDashboard() {
address: "",
port: 22,
username: "",
auth_method: "password",
private_key_ref: "",
password: "",
passwordConfigured: false,
host_key_fingerprint: "",
certificate_path: defaultCertificatePath,
private_key_path: defaultPrivateKeyPath,
@@ -529,6 +532,7 @@ export function useDashboard() {
serverEditingId.value = item.id;
serverForm.value = {
...item,
password: "",
validation_command: (item.validation_command || []).join("\n"),
reload_command: (item.reload_command || []).join("\n"),
server_ids: [],
@@ -643,6 +647,7 @@ export function useDashboard() {
address: serverForm.value.address,
port: Number(serverForm.value.port),
username: serverForm.value.username,
auth_method: serverForm.value.auth_method,
private_key_ref: serverForm.value.private_key_ref,
host_key_fingerprint: serverForm.value.host_key_fingerprint,
certificate_path: serverForm.value.certificate_path,
@@ -652,6 +657,9 @@ export function useDashboard() {
validation_command: parseCommand(serverForm.value.validation_command),
reload_command: parseCommand(serverForm.value.reload_command),
};
if (serverForm.value.auth_method === "password") {
payload.password = serverForm.value.password;
}
const path = serverEditingId.value
? `/api/v1/servers/${serverEditingId.value}`
: "/api/v1/servers";
@@ -89,6 +89,25 @@ const {
required
type="text" /></label
><label class="field"
><span>认证方式</span
><select v-model="serverForm.auth_method">
<option value="password">SSH 密码</option>
<option value="private_key">SSH 私钥</option>
</select></label
>
</div>
<label v-if="serverForm.auth_method === 'password'" class="field">
<span>SSH 密码</span>
<input
v-model="serverForm.password"
type="password"
:required="!serverEditingId || !serverForm.passwordConfigured"
autocomplete="new-password"
placeholder="编辑时留空表示保留原密码"
/>
</label>
<div v-else class="form-grid">
<label class="field"
><span class="field-label-row"
><span>SSH 私钥</span
><button