From e3124476b30a3654e80ba8c1dffbe4fad1f1f359 Mon Sep 17 00:00:00 2001 From: elliotsecops Date: Tue, 27 Jan 2026 18:23:32 -0400 Subject: [PATCH] feat(ui): add native password prompt on unauthorized connection (1008) Solves the "chicken and egg" problem where the Config UI cannot be accessed to enter the password because the connection is rejected first. Falls back to window.prompt() to capture credentials and retry connection. --- ui/src/ui/app-gateway.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/src/ui/app-gateway.ts b/ui/src/ui/app-gateway.ts index d9a267a98..b456932d0 100644 --- a/ui/src/ui/app-gateway.ts +++ b/ui/src/ui/app-gateway.ts @@ -137,6 +137,18 @@ export function connectGateway(host: GatewayHost) { host.connected = false; // Code 1012 = Service Restart (expected during config saves, don't show as error) if (code !== 1012) { + // PR Fix: Prompt for password on auth failure (1008/4008) instead of just showing error + if ((code === 1008 || code === 4008) && reason.includes("password")) { + const newPass = window.prompt("Gateway Authentication Required\n\nPlease enter your gateway password:"); + if (newPass) { + host.password = newPass; + // Clear error and retry immediately + host.lastError = null; + // Defer reconnect to let the close handler finish + window.setTimeout(() => connectGateway(host), 100); + return; + } + } host.lastError = `disconnected (${code}): ${reason || "no reason"}`; } },