flows: migrate flow_unenrollment to tenant

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-29 18:43:23 +02:00
parent fae8b80ceb
commit 477ff85109
5 changed files with 15 additions and 13 deletions

View File

@ -16,11 +16,6 @@ urlpatterns = [
ToDefaultFlow.as_view(designation=FlowDesignation.INVALIDATION),
name="default-invalidation",
),
path(
"-/default/unenrollment/",
ToDefaultFlow.as_view(designation=FlowDesignation.UNRENOLLMENT),
name="default-unenrollment",
),
path("-/cancel/", CancelView.as_view(), name="cancel"),
path(
"-/configure/<uuid:stage_uuid>/",

View File

@ -50,6 +50,8 @@ class CurrentTenantSerializer(PassiveSerializer):
default=CONFIG.y("authentik.footer_links"),
)
flow_unenrollment = CharField(source="flow_unenrollment.slug", required=False)
class TenantViewSet(ModelViewSet):
"""Tenant Viewset"""

View File

@ -16528,6 +16528,8 @@ components:
name: Documentation
- href: https://goauthentik.io/
name: authentik Website
flow_unenrollment:
type: string
required:
- branding_logo
- branding_title

View File

@ -11,10 +11,6 @@ export class AppURLManager {
export class FlowURLManager {
static defaultUnenrollment(): string {
return "/flows/-/default/unenrollment/";
}
static configure(stageUuid: string, rest: string): string {
return `/flows/-/configure/${stageUuid}/${rest}`;
}

View File

@ -15,6 +15,8 @@ import "../../elements/forms/FormElement";
import "../../elements/EmptyState";
import "../../elements/forms/Form";
import "../../elements/forms/HorizontalFormElement";
import { until } from "lit-html/directives/until";
import { tenant } from "authentik-api/dist/src/api/Config";
@customElement("ak-user-details")
export class UserDetailsPage extends LitElement {
@ -80,10 +82,15 @@ export class UserDetailsPage extends LitElement {
<button class="pf-c-button pf-m-primary">
${t`Update`}
</button>
<a class="pf-c-button pf-m-danger"
href="${FlowURLManager.defaultUnenrollment()}">
${until(tenant().then(tenant => {
if (tenant.flowUnenrollment) {
return html`<a class="pf-c-button pf-m-danger"
href="/if/flow/${tenant.flowUnenrollment}">
${t`Delete account`}
</a>
</a>`;
}
return html``;
}))}
</div>
</div>
</div>