web/user: fix post MFA creation link being invalid (#13157)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L.
2025-02-21 16:43:01 +01:00
committed by GitHub
parent 6da0548fa2
commit d98523f243
3 changed files with 6 additions and 3 deletions

View File

@ -13,6 +13,7 @@ export interface GlobalAuthentik {
build: string;
api: {
base: string;
relBase: string;
};
}
@ -27,6 +28,7 @@ export function globalAK(): GlobalAuthentik {
ak.brand = CurrentBrandFromJSON(ak.brand);
ak.config = ConfigFromJSON(ak.config);
}
const apiBase = new URL(process.env.AK_API_BASE_PATH || window.location.origin);
if (!ak) {
return {
config: ConfigFromJSON({
@ -39,7 +41,8 @@ export function globalAK(): GlobalAuthentik {
versionSubdomain: "",
build: "",
api: {
base: process.env.AK_API_BASE_PATH || window.location.origin,
base: apiBase.toString(),
relBase: apiBase.pathname,
},
};
}

View File

@ -32,7 +32,7 @@ export class UserSettingsPassword extends AKElement {
<div class="pf-c-card__body">
<a
href="${ifDefined(this.configureUrl)}${AndNext(
`${globalAK().api.base}if/user/#/settings;${JSON.stringify({ page: "page-details" })}`,
`${globalAK().api.relBase}if/user/#/settings;${JSON.stringify({ page: "page-details" })}`,
)}"
class="pf-c-button pf-m-primary"
>

View File

@ -74,7 +74,7 @@ export class MFADevicesPage extends Table<Device> {
return html`<li>
<a
href="${ifDefined(stage.configureUrl)}${AndNext(
`${globalAK().api.base}if/user/#/settings;${JSON.stringify({
`${globalAK().api.relBase}if/user/#/settings;${JSON.stringify({
page: "page-mfa",
})}`,
)}"