From 1bc48d2bea55245a3de9d3d4765c9c2eb2ce51e8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Mar 2021 22:32:29 +0100 Subject: [PATCH] stages/dummy: fix missing component Signed-off-by: Jens Langhammer --- authentik/stages/dummy/stage.py | 2 +- web/src/flows/FlowExecutor.ts | 5 +- .../flows/access_denied/FlowAccessDenied.ts | 22 -------- web/src/flows/stages/dummy/DummyStage.ts | 52 +++++++++++++++++++ 4 files changed, 57 insertions(+), 24 deletions(-) create mode 100644 web/src/flows/stages/dummy/DummyStage.ts diff --git a/authentik/stages/dummy/stage.py b/authentik/stages/dummy/stage.py index 10f5ad3ca..b4c2f844c 100644 --- a/authentik/stages/dummy/stage.py +++ b/authentik/stages/dummy/stage.py @@ -25,7 +25,7 @@ class DummyStageView(ChallengeStageView): return DummyChallenge( data={ "type": ChallengeTypes.native.value, - "component": "", + "component": "ak-stage-dummy", "title": self.executor.current_stage.name, } ) diff --git a/web/src/flows/FlowExecutor.ts b/web/src/flows/FlowExecutor.ts index f8e63a72f..10297e2b4 100644 --- a/web/src/flows/FlowExecutor.ts +++ b/web/src/flows/FlowExecutor.ts @@ -9,6 +9,7 @@ import PFList from "@patternfly/patternfly/components/List/list.css"; import AKGlobal from "../authentik.css"; import { unsafeHTML } from "lit-html/directives/unsafe-html"; +import "./access_denied/FlowAccessDenied"; import "./stages/authenticator_static/AuthenticatorStaticStage"; import "./stages/authenticator_totp/AuthenticatorTOTPStage"; import "./stages/authenticator_validate/AuthenticatorValidateStage"; @@ -16,11 +17,11 @@ import "./stages/authenticator_webauthn/WebAuthnAuthenticatorRegisterStage"; import "./stages/autosubmit/AutosubmitStage"; import "./stages/captcha/CaptchaStage"; import "./stages/consent/ConsentStage"; +import "./stages/dummy/DummyStage"; import "./stages/email/EmailStage"; import "./stages/identification/IdentificationStage"; import "./stages/password/PasswordStage"; import "./stages/prompt/PromptStage"; -import "./access_denied/FlowAccessDenied"; import { ShellChallenge, RedirectChallenge } from "../api/Flows"; import { IdentificationChallenge } from "./stages/identification/IdentificationStage"; import { PasswordChallenge } from "./stages/password/PasswordStage"; @@ -193,6 +194,8 @@ export class FlowExecutor extends LitElement implements StageHost { return html``; case "ak-stage-consent": return html``; + case "ak-stage-dummy": + return html``; case "ak-stage-email": return html``; case "ak-stage-autosubmit": diff --git a/web/src/flows/access_denied/FlowAccessDenied.ts b/web/src/flows/access_denied/FlowAccessDenied.ts index e6fe27c79..bdbd3df16 100644 --- a/web/src/flows/access_denied/FlowAccessDenied.ts +++ b/web/src/flows/access_denied/FlowAccessDenied.ts @@ -14,7 +14,6 @@ import "../../elements/EmptyState"; export interface AccessDeniedChallenge extends Challenge { error_message?: string; - policy_result?: Record; } @customElement("ak-stage-access-denied") @@ -49,27 +48,6 @@ export class FlowAccessDenied extends BaseStage { ${this.challenge?.error_message && html`

${this.challenge.error_message}

`} - ${this.challenge.policy_result && - html`
- - ${gettext("Explanation:")} - -
    - {% for source_result in policy_result.source_results %} -
  • - {% blocktrans with name=source_result.source_policy.name result=source_result.passing %} - Policy '{{ name }}' returned result '{{ result }}' - {% endblocktrans %} - {% if source_result.messages %} -
      - {% for message in source_result.messages %} -
    • {{ message }}
    • - {% endfor %} -
    - {% endif %} -
  • - {% endfor %} -
`} diff --git a/web/src/flows/stages/dummy/DummyStage.ts b/web/src/flows/stages/dummy/DummyStage.ts new file mode 100644 index 000000000..d54d3389c --- /dev/null +++ b/web/src/flows/stages/dummy/DummyStage.ts @@ -0,0 +1,52 @@ +import { gettext } from "django"; +import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; +import { Challenge } from "../../../api/Flows"; +import PFLogin from "@patternfly/patternfly/components/Login/login.css"; +import PFForm from "@patternfly/patternfly/components/Form/form.css"; +import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css"; +import PFTitle from "@patternfly/patternfly/components/Title/title.css"; +import PFButton from "@patternfly/patternfly/components/Button/button.css"; +import PFBase from "@patternfly/patternfly/patternfly-base.css"; +import AKGlobal from "../../../authentik.css"; +import { BaseStage } from "../base"; +import "../../../elements/EmptyState"; +import "../../FormStatic"; + +@customElement("ak-stage-dummy") +export class DummyStage extends BaseStage { + + @property({ attribute: false }) + challenge?: Challenge; + + static get styles(): CSSResult[] { + return [PFBase, PFLogin, PFForm, PFFormControl, PFTitle, PFButton, AKGlobal]; + } + + render(): TemplateResult { + if (!this.challenge) { + return html` + `; + } + return html` + + `; + } + +}