flows: migrate FlowExecutor error handler to native challenge instead of shell

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-09-06 18:48:15 +02:00
parent 2a4679e390
commit 60266b3345
16 changed files with 182 additions and 76 deletions

View File

@ -0,0 +1,64 @@
import "@goauthentik/web/elements/EmptyState";
import "@goauthentik/web/flows/FormStatic";
import { BaseStage } from "@goauthentik/web/flows/stages/base";
import { t } from "@lingui/macro";
import { CSSResult, TemplateResult, html } from "lit";
import { customElement } from "lit/decorators.js";
import { ifDefined } from "lit/directives/if-defined.js";
import AKGlobal from "@goauthentik/web/authentik.css";
import PFForm from "@patternfly/patternfly/components/Form/form.css";
import PFFormControl from "@patternfly/patternfly/components/FormControl/form-control.css";
import PFLogin from "@patternfly/patternfly/components/Login/login.css";
import PFTitle from "@patternfly/patternfly/components/Title/title.css";
import PFBase from "@patternfly/patternfly/patternfly-base.css";
import { FlowChallengeResponseRequest, FlowErrorChallenge } from "@goauthentik/api";
@customElement("ak-stage-flow-error")
export class FlowErrorStage extends BaseStage<FlowErrorChallenge, FlowChallengeResponseRequest> {
static get styles(): CSSResult[] {
return [PFBase, PFLogin, PFForm, PFFormControl, PFTitle, AKGlobal];
}
render(): TemplateResult {
if (!this.challenge) {
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
}
return html`<header class="pf-c-login__main-header">
<h1 class="pf-c-title pf-m-3xl">${this.challenge.flowInfo?.title}</h1>
</header>
<div class="pf-c-login__main-body">
<form class="pf-c-form">
<ak-form-static
class="pf-c-form__group"
userAvatar="${this.challenge.pendingUserAvatar}"
user=${this.challenge.pendingUser}
>
<div slot="link">
<a href="${ifDefined(this.challenge.flowInfo?.cancelUrl)}"
>${t`Not you?`}</a
>
</div>
</ak-form-static>
<div class="pf-c-form__group">
<p>
${this.challenge?.error
? this.challenge.error
: t`Something went wrong! Please try again later.`}
</p>
${this.challenge?.traceback
? html`<pre class="ak-exception">
${this.challenge.error}${this.challenge.traceback}</pre
>`
: html``}
</div>
</form>
</div>
<footer class="pf-c-login__main-footer">
<ul class="pf-c-login__main-footer-links"></ul>
</footer>`;
}
}

View File

@ -3062,6 +3062,7 @@ msgstr "Server laden"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3700,6 +3701,7 @@ msgstr "Noch nicht synchronisiert."
msgid "Not used by any other object."
msgstr "Von keinem anderen Objekt verwendet."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5069,6 +5071,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "Etwas ist schiefgelaufen. Bitte probiere es später wieder"

View File

@ -3114,6 +3114,7 @@ msgstr "Load servers"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3755,6 +3756,7 @@ msgstr "Not synced yet."
msgid "Not used by any other object."
msgstr "Not used by any other object."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5158,6 +5160,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "Something went wrong! Please try again later."

View File

@ -3055,6 +3055,7 @@ msgstr "Servidores de carga"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3693,6 +3694,7 @@ msgstr "Aún no se ha sincronizado."
msgid "Not used by any other object."
msgstr "No lo usa ningún otro objeto."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5062,6 +5064,7 @@ msgid "Slug"
msgstr "babosa"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "¡Algo salió mal! Inténtelo de nuevo más tarde."

View File

@ -3086,6 +3086,7 @@ msgstr "Charger les serveurs"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3726,6 +3727,7 @@ msgstr "Pas encore synchronisé."
msgid "Not used by any other object."
msgstr "Pas utilisé par un autre objet."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5112,6 +5114,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "Une erreur s'est produite ! Veuillez réessayer plus tard."

View File

@ -3052,6 +3052,7 @@ msgstr "Załaduj serwery"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3690,6 +3691,7 @@ msgstr "Jeszcze nie zsynchronizowano."
msgid "Not used by any other object."
msgstr "Nie używany przez żaden inny obiekt."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5059,6 +5061,7 @@ msgid "Slug"
msgstr "Ślimak"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "Coś poszło nie tak! Spróbuj ponownie później."

View File

@ -3096,6 +3096,7 @@ msgstr ""
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3737,6 +3738,7 @@ msgstr ""
msgid "Not used by any other object."
msgstr ""
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5138,6 +5140,7 @@ msgid "Slug"
msgstr ""
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr ""

View File

@ -3056,6 +3056,7 @@ msgstr "Sunucuları yükle"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3694,6 +3695,7 @@ msgstr "Henüz senkronize edilmedi."
msgid "Not used by any other object."
msgstr "Başka bir nesne tarafından kullanılmaz."
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5064,6 +5066,7 @@ msgid "Slug"
msgstr "Kısa İsim"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "Bir şeyler ters gitti! Lütfen daha sonra tekrar deneyin."

View File

@ -3039,6 +3039,7 @@ msgstr "加载服务器"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3676,6 +3677,7 @@ msgstr "尚未同步。"
msgid "Not used by any other object."
msgstr "不被任何其他对象使用。"
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5029,6 +5031,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "发生了某些错误!请稍后重试。"

View File

@ -3043,6 +3043,7 @@ msgstr "加载服务器"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3680,6 +3681,7 @@ msgstr "尚未同步。"
msgid "Not used by any other object."
msgstr "不被任何其他对象使用。"
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5036,6 +5038,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "发生错误,请稍后重试。"

View File

@ -3043,6 +3043,7 @@ msgstr "加载服务器"
#: src/flows/FlowExecutor.ts
#: src/flows/FlowExecutor.ts
#: src/flows/FlowInspector.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -3680,6 +3681,7 @@ msgstr "尚未同步。"
msgid "Not used by any other object."
msgstr "不被任何其他对象使用。"
#: src/flows/stages/FlowErrorStage.ts
#: src/flows/stages/access_denied/AccessDeniedStage.ts
#: src/flows/stages/authenticator_duo/AuthenticatorDuoStage.ts
#: src/flows/stages/authenticator_sms/AuthenticatorSMSStage.ts
@ -5036,6 +5038,7 @@ msgid "Slug"
msgstr "Slug"
#: src/flows/FlowExecutor.ts
#: src/flows/stages/FlowErrorStage.ts
#: src/user/user-settings/details/UserSettingsFlowExecutor.ts
msgid "Something went wrong! Please try again later."
msgstr "发生错误,请稍后重试。"