web: use FlowURLManager for cancel links

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-27 23:14:21 +01:00
parent e621eb7455
commit 1a53bc3de5
8 changed files with 21 additions and 8 deletions

View File

@ -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/";
}
}

View File

@ -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;

View File

@ -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}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<ak-form-element

View File

@ -15,6 +15,7 @@ import { showMessage } from "../../../elements/messages/MessageContainer";
import "../../../elements/EmptyState";
import "../../FormStatic";
import { MessageLevel } from "../../../elements/messages/Message";
import { FlowURLManager } from "../../../api/legacy";
export interface AuthenticatorTOTPChallenge extends WithUserInfoChallenge {
config_url: string;
@ -49,7 +50,7 @@ export class AuthenticatorTOTPStage extends BaseStage {
userAvatar="${this.challenge.pending_user_avatar}"
user=${this.challenge.pending_user}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<input type="hidden" name="otp_uri" value=${this.challenge.config_url} />

View File

@ -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}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<ak-form-element

View File

@ -13,6 +13,7 @@ import { BaseStage } from "../base";
import "../../../elements/forms/FormElement";
import "../../../elements/EmptyState";
import "../../FormStatic";
import { FlowURLManager } from "../../../api/legacy";
export interface CaptchaChallenge extends WithUserInfoChallenge {
site_key: string;
@ -78,7 +79,7 @@ export class CaptchaStage extends BaseStage {
userAvatar="${this.challenge.pending_user_avatar}"
user=${this.challenge.pending_user}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<div class="ak-loading">

View File

@ -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}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<div class="pf-c-form__group">

View File

@ -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}>
<div slot="link">
<a href="/flows/-/cancel/">${gettext("Not you?")}</a>
<a href="${FlowURLManager.cancel()}">${gettext("Not you?")}</a>
</div>
</ak-form-static>
<input name="username" autocomplete="username" type="hidden" value="${this.challenge.pending_user}">