diff --git a/web/src/api/Config.ts b/web/src/api/Config.ts index d1270964b..a8875d224 100644 --- a/web/src/api/Config.ts +++ b/web/src/api/Config.ts @@ -61,4 +61,11 @@ export const DEFAULT_CONFIG = new Configuration({ ], }); +// This is just a function so eslint doesn't complain about +// missing-whitespace-between-attributes or +// unexpected-character-in-attribute-name +export function AndNext(url: string): string { + return `?next=${encodeURIComponent(url)}`; +} + console.debug(`authentik(early): version ${VERSION}, apiBase ${DEFAULT_CONFIG.basePath}`); diff --git a/web/src/pages/flows/FlowViewPage.ts b/web/src/pages/flows/FlowViewPage.ts index d433534c4..cfea02386 100644 --- a/web/src/pages/flows/FlowViewPage.ts +++ b/web/src/pages/flows/FlowViewPage.ts @@ -14,7 +14,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import { Flow, FlowsApi } from "@goauthentik/api"; -import { DEFAULT_CONFIG } from "../../api/Config"; +import { AndNext, DEFAULT_CONFIG } from "../../api/Config"; import "../../elements/PageHeader"; import "../../elements/Tabs"; import "../../elements/buttons/SpinnerButton"; @@ -100,7 +100,11 @@ export class FlowViewPage extends LitElement { slug: this.flow.slug, }) .then((link) => { - const finalURL = `${link.link}?next=/%23${window.location.hash}`; + const finalURL = `${ + link.link + }${AndNext( + `${window.location.pathname}#${window.location.hash}`, + )}`; window.open(finalURL, "_blank"); }); }} diff --git a/web/src/user/user-settings/details/UserPassword.ts b/web/src/user/user-settings/details/UserPassword.ts index 6ef941396..e41ad101e 100644 --- a/web/src/user/user-settings/details/UserPassword.ts +++ b/web/src/user/user-settings/details/UserPassword.ts @@ -13,6 +13,8 @@ import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; +import { AndNext } from "../../../api/Config"; + @customElement("ak-user-settings-password") export class UserSettingsPassword extends LitElement { @property() @@ -29,7 +31,7 @@ export class UserSettingsPassword extends LitElement {
${t`Change your password`}
{ .map((stage) => { return html`
  • ${t`Not connected.`}