diff --git a/scripts/web-live-dom-probe.mjs b/scripts/web-live-dom-probe.mjs index 1de6a7fa..7f793572 100644 --- a/scripts/web-live-dom-probe.mjs +++ b/scripts/web-live-dom-probe.mjs @@ -263,14 +263,27 @@ async function probeStatus(args) { async function maybeLogin(page, args, actions) { const username = page.locator("#login-username"); - if (!(await username.isVisible({ timeout: Math.min(args.timeoutMs, 12000) }).catch(() => false))) { + if (await username.isVisible({ timeout: Math.min(args.timeoutMs, 12000) }).catch(() => false)) { + await username.fill(args.user); + await page.locator("#login-password").fill(args.pass); + await page.locator("#login-submit").click(); + actions.push({ action: "login", user: args.user, selectorMode: "legacy-id" }); + await page.locator("#command-input").waitFor({ state: "visible", timeout: args.timeoutMs }); + const finalUrl = new URL(page.url()); + if (finalUrl.searchParams.has("username") || finalUrl.searchParams.has("password")) { + throw new Error("login credentials leaked into URL query"); + } + return; + } + const cardInputs = page.locator(".login-card input"); + if ((await cardInputs.count().catch(() => 0)) < 2) { actions.push({ action: "login", skipped: "login-form-not-visible", authState: await page.locator("body").getAttribute("data-auth-state").catch(() => null) }); return; } - await username.fill(args.user); - await page.locator("#login-password").fill(args.pass); - await page.locator("#login-submit").click(); - actions.push({ action: "login", user: args.user }); + await cardInputs.nth(0).fill(args.user); + await cardInputs.nth(1).fill(args.pass); + await page.locator(".login-card button[type=submit]").click(); + actions.push({ action: "login", user: args.user, selectorMode: "login-card" }); await page.locator("#command-input").waitFor({ state: "visible", timeout: args.timeoutMs }); const finalUrl = new URL(page.url()); if (finalUrl.searchParams.has("username") || finalUrl.searchParams.has("password")) { diff --git a/web/hwlab-cloud-web/src/components/agent/TraceTimeline.vue b/web/hwlab-cloud-web/src/components/agent/TraceTimeline.vue index 7c0901b6..f789fe50 100644 --- a/web/hwlab-cloud-web/src/components/agent/TraceTimeline.vue +++ b/web/hwlab-cloud-web/src/components/agent/TraceTimeline.vue @@ -1,7 +1,6 @@