From fc7a452b0c8960e212d3102312b0b4d728a5ce5c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 27 Dec 2021 22:04:30 +0100 Subject: [PATCH] flows: update default flow titles Signed-off-by: Jens Langhammer --- authentik/flows/migrations/0011_flow_title.py | 4 +-- .../migrations/0021_auto_20211227_2103.py | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 authentik/flows/migrations/0021_auto_20211227_2103.py diff --git a/authentik/flows/migrations/0011_flow_title.py b/authentik/flows/migrations/0011_flow_title.py index 2baea0992..5f397dfc5 100644 --- a/authentik/flows/migrations/0011_flow_title.py +++ b/authentik/flows/migrations/0011_flow_title.py @@ -10,8 +10,8 @@ def add_title_for_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): "default-invalidation-flow": "Default Invalidation Flow", "default-source-enrollment": "Welcome to authentik! Please select a username.", "default-source-authentication": "Welcome to authentik!", - "default-provider-authorization-implicit-consent": "Default Provider Authorization Flow (implicit consent)", - "default-provider-authorization-explicit-consent": "Default Provider Authorization Flow (explicit consent)", + "default-provider-authorization-implicit-consent": "Redirecting to %(app)s", + "default-provider-authorization-explicit-consent": "Redirecting to %(app)s", "default-password-change": "Change password", } db_alias = schema_editor.connection.alias diff --git a/authentik/flows/migrations/0021_auto_20211227_2103.py b/authentik/flows/migrations/0021_auto_20211227_2103.py new file mode 100644 index 000000000..701b01bb7 --- /dev/null +++ b/authentik/flows/migrations/0021_auto_20211227_2103.py @@ -0,0 +1,28 @@ +# Generated by Django 4.0 on 2021-12-27 21:03 +from django.apps.registry import Apps +from django.db import migrations, models +from django.db.backends.base.schema import BaseDatabaseSchemaEditor + + +def update_title_for_defaults(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): + slug_title_map = { + "default-provider-authorization-implicit-consent": "Redirecting to %(app)s", + "default-provider-authorization-explicit-consent": "Redirecting to %(app)s", + } + db_alias = schema_editor.connection.alias + Flow = apps.get_model("authentik_flows", "Flow") + for flow in Flow.objects.using(db_alias).all(): + if flow.slug in slug_title_map: + flow.title = slug_title_map[flow.slug] + else: + flow.title = flow.name + flow.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ("authentik_flows", "0020_flowtoken"), + ] + + operations = [migrations.RunPython(update_title_for_defaults)]