Fix SSH Key Password (keyPassword) Field Naming Mismatch Between Frontend and Backend #375
@@ -711,7 +711,7 @@ router.get(
|
|||||||
authType: resolvedHost.authType,
|
authType: resolvedHost.authType,
|
||||||
password: resolvedHost.password || null,
|
password: resolvedHost.password || null,
|
||||||
key: resolvedHost.key || null,
|
key: resolvedHost.key || null,
|
||||||
key_password: resolvedHost.key_password || null,
|
keyPassword: resolvedHost.keyPassword || null,
|
||||||
keyType: resolvedHost.keyType || null,
|
keyType: resolvedHost.keyType || null,
|
||||||
folder: resolvedHost.folder,
|
folder: resolvedHost.folder,
|
||||||
tags:
|
tags:
|
||||||
@@ -1243,7 +1243,11 @@ async function resolveHostCredentials(host: any): Promise<any> {
|
|||||||
// Convert snake_case to camelCase for hosts without credentials
|
// Convert snake_case to camelCase for hosts without credentials
|
||||||
const result = { ...host };
|
const result = { ...host };
|
||||||
if (host.key_password !== undefined) {
|
if (host.key_password !== undefined) {
|
||||||
result.keyPassword = host.key_password;
|
// Only use the inline key_password if keyPassword hasn't been set by credential resolution
|
||||||
|
if (result.keyPassword === undefined) {
|
||||||
|
result.keyPassword = host.key_password;
|
||||||
|
}
|
||||||
|
// Always remove the snake_case version to standardize the output
|
||||||
delete result.key_password;
|
delete result.key_password;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -877,21 +877,8 @@ export function HostManagerEditor({
|
|||||||
| "credential";
|
| "credential";
|
||||||
setAuthTab(newAuthType);
|
setAuthTab(newAuthType);
|
||||||
form.setValue("authType", newAuthType);
|
form.setValue("authType", newAuthType);
|
||||||
|
// Don't clear other auth fields - let them persist
|
||||||
if (newAuthType === "password") {
|
// The backend will only use the fields relevant to the selected authType
|
||||||
form.setValue("key", null);
|
|
||||||
form.setValue("keyPassword", "");
|
|
||||||
form.setValue("keyType", "auto");
|
|
||||||
form.setValue("credentialId", null);
|
|
||||||
} else if (newAuthType === "key") {
|
|
||||||
form.setValue("password", "");
|
|
||||||
form.setValue("credentialId", null);
|
|
||||||
} else if (newAuthType === "credential") {
|
|
||||||
form.setValue("password", "");
|
|
||||||
form.setValue("key", null);
|
|
||||||
form.setValue("keyPassword", "");
|
|
||||||
form.setValue("keyType", "auto");
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
className="flex-1 flex flex-col h-full min-h-0"
|
className="flex-1 flex flex-col h-full min-h-0"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user