Stop prompting SSH credentials for Telnet WebCRT sessions.

Telnet should authenticate interactively in the terminal; only managed/quick-connect SSH without a saved password opens the credential dialog.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-08-02 19:10:49 +08:00
parent 874a6f193d
commit c92879daf3

View file

@ -347,10 +347,11 @@ function isSshAuthFailure(err: unknown): boolean {
); );
} }
/** Inventory managed / Quick Connect. UME uses shared CLI profile — no per-NE popup. */ /** Inventory SSH (managed / Quick Connect). Telnet authenticates in-terminal; UME uses shared profile. */
function isInventoryTarget(target: Pick<CliTargetItem, "source" | "protocol">): boolean { function isInventorySsh(target: Pick<CliTargetItem, "source" | "protocol">): boolean {
const src = String(target.source || "").toLowerCase(); const src = String(target.source || "").toLowerCase();
return src === "webcrt" || src === "managed"; if (src !== "webcrt" && src !== "managed") return false;
return String(target.protocol || "ssh").toLowerCase() !== "telnet";
} }
function isSessionGoneError(err: unknown): boolean { function isSessionGoneError(err: unknown): boolean {
@ -941,8 +942,9 @@ export function WebcrtPage() {
} }
if (connectingKeysRef.current.has(key)) return; if (connectingKeysRef.current.has(key)) return;
// Managed / WebCRT without saved password → credential popup (UME uses shared profile). // Managed / WebCRT SSH without saved password → credential popup.
if (isInventoryTarget(target) && !target.has_password && !opts?.force) { // Telnet stays interactive in the terminal (SecureCRT-style); UME uses shared profile.
if (isInventorySsh(target) && !target.has_password && !opts?.force) {
openAuthForTarget(target); openAuthForTarget(target);
return; return;
} }
@ -1016,7 +1018,7 @@ export function WebcrtPage() {
} catch (err) { } catch (err) {
const message = webcrtErrorMessage(err, t); const message = webcrtErrorMessage(err, t);
const needAuth = const needAuth =
isInventoryTarget(target) && isInventorySsh(target) &&
(String(err).includes("credentials_incomplete") || (String(err).includes("credentials_incomplete") ||
String(err).includes("connect_failed") || String(err).includes("connect_failed") ||
isSshAuthFailure(err)); isSshAuthFailure(err));
@ -2450,7 +2452,7 @@ export function WebcrtPage() {
if (sid) { if (sid) {
void closeWebcrtSession(sid).catch(() => undefined); void closeWebcrtSession(sid).catch(() => undefined);
} }
if (isInventoryTarget(tab.target) && isSshAuthFailure(errMsg)) { if (isInventorySsh(tab.target) && isSshAuthFailure(errMsg)) {
openAuthForTarget(tab.target, webcrtErrorMessage(errMsg, t)); openAuthForTarget(tab.target, webcrtErrorMessage(errMsg, t));
} }
} else if (state === "closed") { } else if (state === "closed") {