mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
feat(ssh-terminal): add host setting to turn off password prompt auto-fill
This commit is contained in:
1 parent
f0d720cf05
commit
c5b2b880b6
8 files changed
+31
No files matched your search
@@ -377,6 +377,7 @@ export interface TerminalConfig {
|
||||
startupSnippetId: number | null;
|
||||
autoMosh: boolean;
|
||||
moshCommand: string;
|
||||
passwordPromptAutoFill?: boolean;
|
||||
sudoPasswordAutoFill: boolean;
|
||||
sudoPassword?: string | null;
|
||||
keepaliveInterval?: number;
|
||||
|
||||
@@ -856,6 +856,7 @@ export const DEFAULT_TERMINAL_CONFIG = {
|
||||
startupSnippetId: null as number | null,
|
||||
autoMosh: false,
|
||||
moshCommand: "mosh-server new -s -l LANG=en_US.UTF-8",
|
||||
passwordPromptAutoFill: true,
|
||||
sudoPasswordAutoFill: false,
|
||||
keepaliveInterval: undefined as number | undefined,
|
||||
keepaliveCountMax: undefined as number | undefined,
|
||||
|
||||
@@ -567,6 +567,8 @@
|
||||
"linkClickBehaviorDefault": "Default (follow app setting)",
|
||||
"linkClickBehaviorConfirm": "Show popup to open or copy",
|
||||
"linkClickBehaviorDirect": "Open directly",
|
||||
"passwordPromptAutoFillLabel": "Offer Password Auto-fill",
|
||||
"passwordPromptAutoFillDesc": "Offer to fill in the saved password when the terminal asks for one. Turn off to never auto-fill any password on this host.",
|
||||
"sudoPasswordAutoFillLabel": "Sudo Password Auto-fill",
|
||||
"sudoPasswordAutoFillShortDesc": "Automatically provide sudo password when prompted",
|
||||
"sudoPasswordAutoFillDesc": "Store a sudo password so host metrics, terminal prompts, and others can run privileged commands automatically.",
|
||||
|
||||
@@ -1005,6 +1005,15 @@ export function HostEditor({
|
||||
onChange={(v) => setField("allowLegacyAlgorithms", v)}
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingRow
|
||||
label={t("hosts.passwordPromptAutoFillLabel")}
|
||||
description={t("hosts.passwordPromptAutoFillDesc")}
|
||||
>
|
||||
<FakeSwitch
|
||||
checked={form.passwordPromptAutoFill}
|
||||
onChange={(v) => setField("passwordPromptAutoFill", v)}
|
||||
/>
|
||||
</SettingRow>
|
||||
<SettingRow
|
||||
label={t("hosts.sudoPasswordAutoFillLabel")}
|
||||
description={t("hosts.sudoPasswordAutoFillDesc")}
|
||||
|
||||
@@ -200,6 +200,8 @@ export function createHostEditorForm(
|
||||
agentForwarding: host?.terminalConfig?.agentForwarding ?? false,
|
||||
autoMosh: host?.terminalConfig?.autoMosh ?? false,
|
||||
autoTmux: host?.terminalConfig?.autoTmux ?? d?.autoTmux ?? false,
|
||||
passwordPromptAutoFill:
|
||||
host?.terminalConfig?.passwordPromptAutoFill ?? true,
|
||||
sudoPasswordAutoFill: host?.terminalConfig?.sudoPasswordAutoFill ?? false,
|
||||
sudoPassword: host?.hasSudoPassword
|
||||
? "existing_sudo_password"
|
||||
@@ -344,6 +346,7 @@ export function buildHostEditorPayload(
|
||||
agentForwarding: form.agentForwarding,
|
||||
autoMosh: form.autoMosh,
|
||||
autoTmux: form.autoTmux,
|
||||
passwordPromptAutoFill: form.passwordPromptAutoFill,
|
||||
sudoPasswordAutoFill: form.sudoPasswordAutoFill,
|
||||
sudoPassword:
|
||||
form.sudoPassword === "existing_sudo_password"
|
||||
|
||||
@@ -278,6 +278,18 @@ describe("buildHostEditorPayload auth field isolation", () => {
|
||||
expect(tc?.sudoPasswordAutoFill).toBe(true);
|
||||
expect(tc?.sudoPassword).toBe("sudo-secret");
|
||||
});
|
||||
|
||||
it("defaults password prompt autofill on and saves it when turned off", () => {
|
||||
expect(createHostEditorForm(null).passwordPromptAutoFill).toBe(true);
|
||||
|
||||
const form = {
|
||||
...createHostEditorForm(null),
|
||||
passwordPromptAutoFill: false,
|
||||
};
|
||||
const payload = buildHostEditorPayload(form, sshOnly);
|
||||
|
||||
expect(payload.terminalConfig?.passwordPromptAutoFill).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("sudo password persistence indicator", () => {
|
||||
|
||||
Reference in new issue
Block a user