mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 14:15:24 +00:00
fix: sudo password not autofilling (#1248)
https://github.com/Termix-SSH/Support/issues/1248
This commit is contained in:
1 parent
7727fa09fb
commit
a9a3bbc5f4
1 file changed
+8
-1
@@ -1197,6 +1197,14 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
/(?:\[sudo\][^\n\r]*:\s*$|sudo:[^\n\r]*password[^\n\r]*required|password for [^\n\r]*:\s*$|Password:\s*$|password:\s*$)/im;
|
||||
if (!passwordPromptPattern.test(buffered)) return;
|
||||
|
||||
const isSudoPrompt = /(?:\[sudo\]|sudo:)/i.test(buffered);
|
||||
|
||||
// Sudo autofill is opt-in: the saved sudo password must not be sent
|
||||
// to a privilege-escalation prompt unless the host explicitly enables it.
|
||||
if (isSudoPrompt && !hostConfig.terminalConfig?.sudoPasswordAutoFill) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hasStoredPassword =
|
||||
hostConfig.terminalConfig?.sudoPassword ||
|
||||
hostConfig.password ||
|
||||
@@ -1206,7 +1214,6 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
||||
|
||||
passwordPromptShownRef.current = true;
|
||||
passwordPromptBufferRef.current = "";
|
||||
const isSudoPrompt = /(?:\[sudo\]|sudo:)/i.test(buffered);
|
||||
|
||||
confirmWithToast(
|
||||
t("terminal.passwordPromptFillTitle"),
|
||||
|
||||
Reference in new issue
Block a user