web/admin: fix enable buttons missing on stages

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-24 22:21:18 +02:00
parent 8183a51b72
commit af504e13a2
6 changed files with 14 additions and 20 deletions

View file

@ -26,16 +26,13 @@ import "./stages/password/PasswordStage";
import "./stages/prompt/PromptStage"; import "./stages/prompt/PromptStage";
import "./sources/plex/PlexLoginInit"; import "./sources/plex/PlexLoginInit";
import { StageHost } from "./stages/base"; 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 { config, DEFAULT_CONFIG } from "../api/Config";
import { ifDefined } from "lit-html/directives/if-defined"; import { ifDefined } from "lit-html/directives/if-defined";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { PFSize } from "../elements/Spinner"; import { PFSize } from "../elements/Spinner";
import { TITLE_DEFAULT } from "../constants"; import { TITLE_DEFAULT } from "../constants";
import { configureSentry } from "../api/Sentry"; import { configureSentry } from "../api/Sentry";
import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest";
import { FlowChallengeResponseRequest } from "authentik-api/src";
@customElement("ak-flow-executor") @customElement("ak-flow-executor")
export class FlowExecutor extends LitElement implements StageHost { export class FlowExecutor extends LitElement implements StageHost {
@ -98,8 +95,9 @@ export class FlowExecutor extends LitElement implements StageHost {
} }
submit(payload: FlowChallengeResponseRequest): Promise<void> { submit(payload: FlowChallengeResponseRequest): Promise<void> {
if (!this.challenge) return Promise.reject();
// @ts-ignore // @ts-ignore
payload.component = this.challenge?.component; payload.component = this.challenge.component;
this.loading = true; this.loading = true;
return new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({ return new FlowsApi(DEFAULT_CONFIG).flowsExecutorSolve({
flowSlug: this.flowSlug, flowSlug: this.flowSlug,

View file

@ -1,4 +1,4 @@
import { AccessDeniedChallenge } from "authentik-api"; import { AccessDeniedChallenge, FlowChallengeResponseRequest } from "authentik-api";
import { CSSResult, customElement, html, TemplateResult } from "lit-element"; import { CSSResult, customElement, html, TemplateResult } from "lit-element";
import { BaseStage } from "../stages/base"; import { BaseStage } from "../stages/base";
import PFLogin from "@patternfly/patternfly/components/Login/login.css"; import PFLogin from "@patternfly/patternfly/components/Login/login.css";
@ -11,7 +11,6 @@ import AKGlobal from "../../authentik.css";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import "../../elements/EmptyState"; import "../../elements/EmptyState";
import { FlowChallengeResponseRequest } from "authentik-api/src";
@customElement("ak-stage-access-denied") @customElement("ak-stage-access-denied")
export class FlowAccessDenied extends BaseStage<AccessDeniedChallenge, FlowChallengeResponseRequest> { export class FlowAccessDenied extends BaseStage<AccessDeniedChallenge, FlowChallengeResponseRequest> {

View file

@ -10,8 +10,7 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css";
import AKGlobal from "../../../authentik.css"; import AKGlobal from "../../../authentik.css";
import "../../../elements/forms/FormElement"; import "../../../elements/forms/FormElement";
import "../../../elements/EmptyState"; import "../../../elements/EmptyState";
import { IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api"; import { FlowChallengeRequest, IdentificationChallenge, IdentificationChallengeResponseRequest, UILoginButton } from "authentik-api";
import { FlowChallengeRequest } from "authentik-api/src/models/FlowChallengeRequest";
export const PasswordManagerPrefill: { export const PasswordManagerPrefill: {
password: string | undefined; password: string | undefined;

View file

@ -14,8 +14,7 @@ import "../../../elements/forms/FormElement";
import "../../../elements/EmptyState"; import "../../../elements/EmptyState";
import "../../../elements/Divider"; import "../../../elements/Divider";
import { Error } from "../../../api/Flows"; import { Error } from "../../../api/Flows";
import { PromptChallenge, StagePrompt } from "authentik-api"; import { PromptChallenge, PromptChallengeResponseRequest, StagePrompt } from "authentik-api";
import { PromptChallengeResponseRequest } from "authentik-api/src/models/PromptChallengeResponseRequest";
@customElement("ak-stage-prompt") @customElement("ak-stage-prompt")

View file

@ -1,5 +1,4 @@
import { CertificateGenerationRequest, CryptoApi } from "authentik-api"; import { CertificateGenerationRequest, CertificateKeyPair, CryptoApi } from "authentik-api";
import { CertificateKeyPair } from "authentik-api/src";
import { t } from "@lingui/macro"; import { t } from "@lingui/macro";
import { customElement } from "lit-element"; import { customElement } from "lit-element";
import { html, TemplateResult } from "lit-html"; import { html, TemplateResult } from "lit-html";

View file

@ -13,7 +13,7 @@ import AKGlobal from "../../authentik.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css";
import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css";
import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.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 { DEFAULT_CONFIG } from "../../api/Config";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import { ifDefined } from "lit-html/directives/if-defined"; 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]; return [PFBase, PFPage, PFFlex, PFDisplay, PFGallery, PFContent, PFCard, PFDescriptionList, PFSizing, PFForm, PFFormControl, AKGlobal];
} }
renderStageSettings(stage: UserSetting): TemplateResult { renderStageSettings(stage: StageUserSetting): TemplateResult {
switch (stage.component) { switch (stage.component) {
case "ak-user-settings-authenticator-webauthn": case "ak-user-settings-authenticator-webauthn":
return html`<ak-user-settings-authenticator-webauthn objectId=${stage.objectUid}> return html`<ak-user-settings-authenticator-webauthn objectId=${stage.objectUid} ?configureFlow=${stage.configureFlow}>
</ak-user-settings-authenticator-webauthn>`; </ak-user-settings-authenticator-webauthn>`;
case "ak-user-settings-password": case "ak-user-settings-password":
return html`<ak-user-settings-password objectId=${stage.objectUid}> return html`<ak-user-settings-password objectId=${stage.objectUid} ?configureFlow=${stage.configureFlow}>
</ak-user-settings-password>`; </ak-user-settings-password>`;
case "ak-user-settings-authenticator-totp": case "ak-user-settings-authenticator-totp":
return html`<ak-user-settings-authenticator-totp objectId=${stage.objectUid}> return html`<ak-user-settings-authenticator-totp objectId=${stage.objectUid} ?configureFlow=${stage.configureFlow}>
</ak-user-settings-authenticator-totp>`; </ak-user-settings-authenticator-totp>`;
case "ak-user-settings-authenticator-static": case "ak-user-settings-authenticator-static":
return html`<ak-user-settings-authenticator-static objectId=${stage.objectUid}> return html`<ak-user-settings-authenticator-static objectId=${stage.objectUid} ?configureFlow=${stage.configureFlow}>
</ak-user-settings-authenticator-static>`; </ak-user-settings-authenticator-static>`;
case "ak-user-settings-authenticator-duo": case "ak-user-settings-authenticator-duo":
return html`<ak-user-settings-authenticator-duo objectId=${stage.objectUid}> return html`<ak-user-settings-authenticator-duo objectId=${stage.objectUid} ?configureFlow=${stage.configureFlow}>
</ak-user-settings-authenticator-duo>`; </ak-user-settings-authenticator-duo>`;
default: default:
return html`<p>${t`Error: unsupported stage settings: ${stage.component}`}</p>`; return html`<p>${t`Error: unsupported stage settings: ${stage.component}`}</p>`;