diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 9b853b089..d2f6a012c 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-03 14:41+0000\n" +"POT-Creation-Date: 2023-05-05 20:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -65,7 +65,7 @@ msgstr "" msgid "authentik Export - %(date)s" msgstr "" -#: authentik/blueprints/v1/tasks.py:146 authentik/crypto/tasks.py:93 +#: authentik/blueprints/v1/tasks.py:149 authentik/crypto/tasks.py:93 #, python-format msgid "Successfully imported %(count)d files." msgstr "" diff --git a/web/src/flow/FlowExecutor.ts b/web/src/flow/FlowExecutor.ts index b22711edc..d581245c4 100644 --- a/web/src/flow/FlowExecutor.ts +++ b/web/src/flow/FlowExecutor.ts @@ -37,7 +37,6 @@ import { FlowErrorChallenge, FlowsApi, LayoutEnum, - RedirectChallenge, ResponseError, ShellChallenge, UiThemeEnum, @@ -52,18 +51,6 @@ export class FlowExecutor extends Interface implements StageHost { @property({ attribute: false }) set challenge(value: ChallengeTypes | undefined) { this._challenge = value; - // Assign the location as soon as we get the challenge and *not* in the render function - // as the render function might be called multiple times, which will navigate multiple - // times and can invalidate oauth codes - // Also only auto-redirect when the inspector is open, so that a user can inspect the - // redirect in the inspector - if (value?.type === ChallengeChoices.Redirect && !this.inspectorOpen) { - console.debug( - "authentik/flows: redirecting to url from server", - (value as RedirectChallenge).to, - ); - window.location.assign((value as RedirectChallenge).to); - } if (value?.flowInfo?.title) { document.title = `${value.flowInfo?.title} - ${this.tenant?.brandingTitle}`; } else { @@ -407,15 +394,12 @@ export class FlowExecutor extends Interface implements StageHost { } switch (this.challenge.type) { case ChallengeChoices.Redirect: - if (this.inspectorOpen) { - return html` - `; - } - return html` - `; + return html` + `; case ChallengeChoices.Shell: return html`${unsafeHTML((this.challenge as ShellChallenge).body)}`; case ChallengeChoices.Native: diff --git a/web/src/flow/stages/RedirectStage.ts b/web/src/flow/stages/RedirectStage.ts index fda5db764..f542edfc4 100644 --- a/web/src/flow/stages/RedirectStage.ts +++ b/web/src/flow/stages/RedirectStage.ts @@ -3,7 +3,7 @@ import { BaseStage } from "@goauthentik/flow/stages/base"; import { t } from "@lingui/macro"; import { CSSResult, TemplateResult, css, html } from "lit"; -import { customElement } from "lit/decorators.js"; +import { customElement, property, state } from "lit/decorators.js"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css"; @@ -16,6 +16,12 @@ import { FlowChallengeResponseRequest, RedirectChallenge } from "@goauthentik/ap @customElement("ak-stage-redirect") export class RedirectStage extends BaseStage { + @property({ type: Boolean }) + promptUser = false; + + @state() + startedRedirect = false; + static get styles(): CSSResult[] { return [ PFBase, @@ -39,12 +45,46 @@ export class RedirectStage extends BaseStage { + window.close(); + }, 500); + return html` + `; + } + return html` `; + } + render(): TemplateResult { + if (this.startedRedirect || !this.promptUser) { + return this.renderLoading(); + } return html`