From af504e13a2251e909c6ff10923adbc82b262b771 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 24 May 2021 22:21:18 +0200 Subject: [PATCH] web/admin: fix enable buttons missing on stages Signed-off-by: Jens Langhammer --- web/src/flows/FlowExecutor.ts | 8 +++----- web/src/flows/access_denied/FlowAccessDenied.ts | 3 +-- .../stages/identification/IdentificationStage.ts | 3 +-- web/src/flows/stages/prompt/PromptStage.ts | 3 +-- web/src/pages/crypto/CertificateGenerateForm.ts | 3 +-- web/src/pages/user-settings/UserSettingsPage.ts | 14 +++++++------- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/web/src/flows/FlowExecutor.ts b/web/src/flows/FlowExecutor.ts index 44bfc9429..23a775b62 100644 --- a/web/src/flows/FlowExecutor.ts +++ b/web/src/flows/FlowExecutor.ts @@ -26,16 +26,13 @@ import "./stages/password/PasswordStage"; import "./stages/prompt/PromptStage"; import "./sources/plex/PlexLoginInit"; import { StageHost } from "./stages/base"; -import { ChallengeChoices, Config, FlowsApi, RedirectChallenge, ShellChallenge } from "authentik-api"; +import { ChallengeChoices, Config, FlowChallengeRequest, FlowChallengeResponseRequest, FlowsApi, RedirectChallenge, ShellChallenge } from "authentik-api"; import { config, DEFAULT_CONFIG } from "../api/Config"; import { ifDefined } from "lit-html/directives/if-defined"; import { until } from "lit-html/directives/until"; import { PFSize } from "../elements/Spinner"; import { TITLE_DEFAULT } from "../constants"; import { configureSentry } from "../api/Sentry"; -import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest"; -import { FlowChallengeResponseRequest } from "authentik-api/src"; - @customElement("ak-flow-executor") export class FlowExecutor extends LitElement implements StageHost { @@ -98,8 +95,9 @@ export class FlowExecutor extends LitElement implements StageHost { } submit(payload: FlowChallengeResponseRequest): Promise { + if (!this.challenge) return Promise.reject(); // @ts-ignore - payload.component = this.challenge?.component; + payload.component = this.challenge.component; this.loading = true; return new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({ flowSlug: this.flowSlug, diff --git a/web/src/flows/access_denied/FlowAccessDenied.ts b/web/src/flows/access_denied/FlowAccessDenied.ts index f2bceb9f1..9b8cae20a 100644 --- a/web/src/flows/access_denied/FlowAccessDenied.ts +++ b/web/src/flows/access_denied/FlowAccessDenied.ts @@ -1,4 +1,4 @@ -import { AccessDeniedChallenge } from "authentik-api"; +import { AccessDeniedChallenge, FlowChallengeResponseRequest } from "authentik-api"; import { CSSResult, customElement, html, TemplateResult } from "lit-element"; import { BaseStage } from "../stages/base"; import PFLogin from "@patternfly/patternfly/components/Login/login.css"; @@ -11,7 +11,6 @@ import AKGlobal from "../../authentik.css"; import { t } from "@lingui/macro"; import "../../elements/EmptyState"; -import { FlowChallengeResponseRequest } from "authentik-api/src"; @customElement("ak-stage-access-denied") export class FlowAccessDenied extends BaseStage { diff --git a/web/src/flows/stages/identification/IdentificationStage.ts b/web/src/flows/stages/identification/IdentificationStage.ts index 641fce3d6..c14d61630 100644 --- a/web/src/flows/stages/identification/IdentificationStage.ts +++ b/web/src/flows/stages/identification/IdentificationStage.ts @@ -10,8 +10,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import AKGlobal from "../../../authentik.css"; import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; -import { IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api"; -import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest"; +import { FlowChallengeRequest, IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api"; export const PasswordManagerPrefill: { password: string | undefined; diff --git a/web/src/flows/stages/prompt/PromptStage.ts b/web/src/flows/stages/prompt/PromptStage.ts index b58a154e8..94f8a7417 100644 --- a/web/src/flows/stages/prompt/PromptStage.ts +++ b/web/src/flows/stages/prompt/PromptStage.ts @@ -14,8 +14,7 @@ import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; import "../../../elements/Divider"; import { Error } from "../../../api/Flows"; -import { PromptChallenge, StagePrompt } from "authentik-api"; -import { PromptChallengeResponseRequest } from "authentik-api/src/models/PromptChallengeResponseRequest"; +import { PromptChallenge, PromptChallengeResponseRequest, StagePrompt } from "authentik-api"; @customElement("ak-stage-prompt") diff --git a/web/src/pages/crypto/CertificateGenerateForm.ts b/web/src/pages/crypto/CertificateGenerateForm.ts index 4c479348e..8491dbd9b 100644 --- a/web/src/pages/crypto/CertificateGenerateForm.ts +++ b/web/src/pages/crypto/CertificateGenerateForm.ts @@ -1,5 +1,4 @@ -import { CertificateGenerationRequest, CryptoApi } from "authentik-api"; -import { CertificateKeyPair } from "authentik-api/src"; +import { CertificateGenerationRequest, CertificateKeyPair, CryptoApi } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement } from "lit-element"; import { html, TemplateResult } from "lit-html"; diff --git a/web/src/pages/user-settings/UserSettingsPage.ts b/web/src/pages/user-settings/UserSettingsPage.ts index f34f99d38..b01d1e1b3 100644 --- a/web/src/pages/user-settings/UserSettingsPage.ts +++ b/web/src/pages/user-settings/UserSettingsPage.ts @@ -13,7 +13,7 @@ import AKGlobal from "../../authentik.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; -import { SourcesApi, StagesApi, UserSetting } from "authentik-api"; +import { SourcesApi, StagesApi, StageUserSetting, UserSetting } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import { until } from "lit-html/directives/until"; import { ifDefined } from "lit-html/directives/if-defined"; @@ -35,22 +35,22 @@ export class UserSettingsPage extends LitElement { return [PFBase, PFPage, PFFlex, PFDisplay, PFGallery, PFContent, PFCard, PFDescriptionList, PFSizing, PFForm, PFFormControl, AKGlobal]; } - renderStageSettings(stage: UserSetting): TemplateResult { + renderStageSettings(stage: StageUserSetting): TemplateResult { switch (stage.component) { case "ak-user-settings-authenticator-webauthn": - return html` + return html` `; case "ak-user-settings-password": - return html` + return html` `; case "ak-user-settings-authenticator-totp": - return html` + return html` `; case "ak-user-settings-authenticator-static": - return html` + return html` `; case "ak-user-settings-authenticator-duo": - return html` + return html` `; default: return html`

${t`Error: unsupported stage settings: ${stage.component}`}

`;