web: fix linting errors by adding a wrapper for next param
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -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}`); | ||||
|  | ||||
| @ -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"); | ||||
|                                                             }); | ||||
|                                                     }} | ||||
|  | ||||
| @ -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 { | ||||
|             <div class="pf-c-card__title">${t`Change your password`}</div> | ||||
|             <div class="pf-c-card__body"> | ||||
|                 <a | ||||
|                     href="${ifDefined(this.configureUrl)}?next=${encodeURIComponent( | ||||
|                     href="${ifDefined(this.configureUrl)}${AndNext( | ||||
|                         "/if/user/#/settings;page-details", | ||||
|                     )}" | ||||
|                     class="pf-c-button pf-m-primary" | ||||
|  | ||||
| @ -8,7 +8,7 @@ import { until } from "lit/directives/until.js"; | ||||
| import { AuthenticatorsApi, Device, UserSetting } from "@goauthentik/api"; | ||||
|  | ||||
| import { AKResponse } from "../../../api/Client"; | ||||
| import { DEFAULT_CONFIG } from "../../../api/Config"; | ||||
| import { AndNext, DEFAULT_CONFIG } from "../../../api/Config"; | ||||
| import "../../../elements/buttons/Dropdown"; | ||||
| import "../../../elements/buttons/ModalButton"; | ||||
| import "../../../elements/buttons/TokenCopyButton"; | ||||
| @ -78,9 +78,7 @@ export class MFADevicesPage extends Table<Device> { | ||||
|                                 .map((stage) => { | ||||
|                                     return html`<li> | ||||
|                                         <a | ||||
|                                             href="${ifDefined( | ||||
|                                                 stage.configureUrl, | ||||
|                                             )}?next=${encodeURIComponent( | ||||
|                                             href="${ifDefined(stage.configureUrl)}${AndNext( | ||||
|                                                 "/if/user/#/settings;page-mfa", | ||||
|                                             )}" | ||||
|                                             class="pf-c-dropdown__menu-item" | ||||
|  | ||||
| @ -7,7 +7,7 @@ import { until } from "lit/directives/until.js"; | ||||
|  | ||||
| import { SourcesApi } from "@goauthentik/api"; | ||||
|  | ||||
| import { DEFAULT_CONFIG } from "../../../api/Config"; | ||||
| import { AndNext, DEFAULT_CONFIG } from "../../../api/Config"; | ||||
| import { BaseUserSettings } from "../BaseUserSettings"; | ||||
|  | ||||
| @customElement("ak-user-settings-source-oauth") | ||||
| @ -47,7 +47,7 @@ export class SourceSettingsOAuth extends BaseUserSettings { | ||||
|                     return html`<p>${t`Not connected.`}</p> | ||||
|                         <a | ||||
|                             class="pf-c-button pf-m-primary" | ||||
|                             href="${ifDefined(this.configureUrl)}?next=${encodeURIComponent( | ||||
|                             href="${ifDefined(this.configureUrl)}${AndNext( | ||||
|                                 "/if/user/#/settings;page-sources", | ||||
|                             )}" | ||||
|                         > | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer