clan-app: Add password input

This commit is contained in:
Qubasa
2025-09-02 13:37:12 +02:00
parent 0ac6d7be87
commit 53ce3cf53d
4 changed files with 46 additions and 5 deletions

View File

@@ -53,6 +53,7 @@ export interface InstallStoreType {
install: {
targetHost: string;
port?: string;
password?: string;
machineName: string;
mainDisk: string;
// ...TODO Vars

View File

@@ -54,6 +54,7 @@ const ConfigureAdressSchema = v.object({
v.transform((val) => (val === "" ? undefined : val)),
),
),
password: v.optional(v.string()),
});
type ConfigureAdressForm = v.InferInput<typeof ConfigureAdressSchema>;
@@ -84,6 +85,7 @@ const ConfigureAddress = () => {
...s,
targetHost: values.targetHost,
port: values.port,
password: values.password,
}));
// Here you would typically trigger the ISO creation process
@@ -98,12 +100,14 @@ const ConfigureAddress = () => {
const portValue = getValue(formStore, "port");
const port = portValue ? parseInt(portValue, 10) : undefined;
const password = getValue(formStore, "password") || undefined;
setLoading(true);
const call = client.fetch("check_machine_ssh_login", {
remote: {
address,
...(port && { port }),
password: password,
ssh_options: {
StrictHostKeyChecking: "no",
UserKnownHostsFile: "/dev/null",
@@ -163,6 +167,24 @@ const ConfigureAddress = () => {
/>
)}
</Field>
<Field name="password">
{(field, props) => (
<TextInput
{...field}
label="Password"
description="SSH password (optional)"
value={field.value}
orientation="horizontal"
validationState={
getError(formStore, "port") ? "invalid" : "valid"
}
input={{
...props,
type: "password",
}}
/>
)}
</Field>
</Fieldset>
</div>
}
@@ -224,6 +246,7 @@ const CheckHardware = () => {
target_host: {
address: store.install.targetHost,
...(port && { port }),
password: store.install.password,
ssh_options: {
StrictHostKeyChecking: "no",
UserKnownHostsFile: "/dev/null",
@@ -650,6 +673,7 @@ const InstallSummary = () => {
target_host: {
address: store.install.targetHost,
...(port && { port }),
password: store.install.password,
ssh_options: {
StrictHostKeyChecking: "no",
UserKnownHostsFile: "/dev/null",