From 1a53bc3de5cf6592170ca026eaeac15a6b3dda95 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 27 Mar 2021 23:14:21 +0100 Subject: [PATCH] web: use FlowURLManager for cancel links Signed-off-by: Jens Langhammer --- web/src/api/legacy.ts | 6 +++++- web/src/elements/messages/Message.ts | 5 ++++- .../stages/authenticator_static/AuthenticatorStaticStage.ts | 3 ++- .../stages/authenticator_totp/AuthenticatorTOTPStage.ts | 3 ++- .../AuthenticatorValidateStageCode.ts | 3 ++- web/src/flows/stages/captcha/CaptchaStage.ts | 3 ++- web/src/flows/stages/consent/ConsentStage.ts | 3 ++- web/src/flows/stages/password/PasswordStage.ts | 3 ++- 8 files changed, 21 insertions(+), 8 deletions(-) diff --git a/web/src/api/legacy.ts b/web/src/api/legacy.ts index c8a520d71..c07b02f2d 100644 --- a/web/src/api/legacy.ts +++ b/web/src/api/legacy.ts @@ -106,7 +106,11 @@ export class AppURLManager { export class FlowURLManager { static configure(stageUuid: string, rest: string): string { - return `-/configure/${stageUuid}/${rest}`; + return `/flows/-/configure/${stageUuid}/${rest}`; + } + + static cancel(): string { + return "/flows/-/cancel/"; } } diff --git a/web/src/elements/messages/Message.ts b/web/src/elements/messages/Message.ts index fddedd87c..f4e0bf60e 100644 --- a/web/src/elements/messages/Message.ts +++ b/web/src/elements/messages/Message.ts @@ -6,7 +6,10 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; export enum MessageLevel { - "error", "warning", "success", "info" + error = "error", + warning = "warning", + success = "success", + info = "info" } export interface APIMessage { level: MessageLevel; diff --git a/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts b/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts index e79237d7d..cee973c07 100644 --- a/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts +++ b/web/src/flows/stages/authenticator_static/AuthenticatorStaticStage.ts @@ -12,6 +12,7 @@ import { BaseStage } from "../base"; import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; import "../../FormStatic"; +import { FlowURLManager } from "../../../api/legacy"; export const STATIC_TOKEN_STYLE = css` /* Static OTP Tokens */ @@ -61,7 +62,7 @@ export class AuthenticatorStaticStage extends BaseStage { userAvatar="${this.challenge.pending_user_avatar}" user=${this.challenge.pending_user}>
- ${gettext("Not you?")} + ${gettext("Not you?")}
- ${gettext("Not you?")} + ${gettext("Not you?")}
diff --git a/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts b/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts index 0a094ce4f..d5be69405 100644 --- a/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts +++ b/web/src/flows/stages/authenticator_validate/AuthenticatorValidateStageCode.ts @@ -13,6 +13,7 @@ import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; import { PasswordManagerPrefill } from "../identification/IdentificationStage"; import "../../FormStatic"; +import { FlowURLManager } from "../../../api/legacy"; @customElement("ak-stage-authenticator-validate-code") export class AuthenticatorValidateStageWebCode extends BaseStage { @@ -44,7 +45,7 @@ export class AuthenticatorValidateStageWebCode extends BaseStage { userAvatar="${this.challenge.pending_user_avatar}" user=${this.challenge.pending_user}>
- ${gettext("Not you?")} + ${gettext("Not you?")}
- ${gettext("Not you?")} + ${gettext("Not you?")}
diff --git a/web/src/flows/stages/consent/ConsentStage.ts b/web/src/flows/stages/consent/ConsentStage.ts index 9e0d3a93d..f8c1f1d8e 100644 --- a/web/src/flows/stages/consent/ConsentStage.ts +++ b/web/src/flows/stages/consent/ConsentStage.ts @@ -11,6 +11,7 @@ import AKGlobal from "../../../authentik.css"; import { BaseStage } from "../base"; import "../../../elements/EmptyState"; import "../../FormStatic"; +import { FlowURLManager } from "../../../api/legacy"; export interface Permission { name: string; @@ -53,7 +54,7 @@ export class ConsentStage extends BaseStage { userAvatar="${this.challenge.pending_user_avatar}" user=${this.challenge.pending_user}>
diff --git a/web/src/flows/stages/password/PasswordStage.ts b/web/src/flows/stages/password/PasswordStage.ts index 868e84193..0cab171e8 100644 --- a/web/src/flows/stages/password/PasswordStage.ts +++ b/web/src/flows/stages/password/PasswordStage.ts @@ -13,6 +13,7 @@ import "../../../elements/forms/FormElement"; import "../../../elements/EmptyState"; import { PasswordManagerPrefill } from "../identification/IdentificationStage"; import "../../FormStatic"; +import { FlowURLManager } from "../../../api/legacy"; export interface PasswordChallenge extends WithUserInfoChallenge { recovery_url?: string; @@ -47,7 +48,7 @@ export class PasswordStage extends BaseStage { userAvatar="${this.challenge.pending_user_avatar}" user=${this.challenge.pending_user}>