fix(wizard): handle undefined token input during onboarding
When user leaves token blank during onboarding or `configure gateway`, `text()` may return `undefined` at runtime (despite TypeScript type declaring `string`). `String(undefined)` produces the literal string "undefined" which is truthy, so `randomToken()` was never called. Fix: Use nullish coalescing `(tokenInput ?? "")` to convert undefined to empty string before `.trim()`, allowing the `|| randomToken()` fallback to work correctly. Fixes #3384 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fdcac0ccf4
commit
7f5e7407ab
@ -175,7 +175,7 @@ export async function promptGatewayConfig(
|
|||||||
}),
|
}),
|
||||||
runtime,
|
runtime,
|
||||||
);
|
);
|
||||||
gatewayToken = String(tokenInput).trim() || randomToken();
|
gatewayToken = (tokenInput ?? "").trim() || randomToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authMode === "password") {
|
if (authMode === "password") {
|
||||||
|
|||||||
@ -180,7 +180,7 @@ export async function configureGatewayForOnboarding(
|
|||||||
placeholder: "Needed for multi-machine or non-loopback access",
|
placeholder: "Needed for multi-machine or non-loopback access",
|
||||||
initialValue: quickstartGateway.token ?? "",
|
initialValue: quickstartGateway.token ?? "",
|
||||||
});
|
});
|
||||||
gatewayToken = String(tokenInput).trim() || randomToken();
|
gatewayToken = (tokenInput ?? "").trim() || randomToken();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user