From 800df332b57a03a15ec532172fbedb5c460745a2 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 14 Jun 2021 22:55:32 +0200 Subject: [PATCH] stages/authenticator_duo: don't create default duo stage Signed-off-by: Jens Langhammer --- .../migrations/0002_default_setup_flow.py | 42 +------------------ authentik/stages/identification/stage.py | 7 +--- 2 files changed, 2 insertions(+), 47 deletions(-) diff --git a/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py b/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py index 858b65be8..a1b58ff66 100644 --- a/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py +++ b/authentik/stages/authenticator_duo/migrations/0002_default_setup_flow.py @@ -1,44 +1,6 @@ # Generated by Django 3.1.1 on 2020-09-25 14:32 -from django.apps.registry import Apps from django.db import migrations -from django.db.backends.base.schema import BaseDatabaseSchemaEditor - -from authentik.flows.models import FlowDesignation - - -def create_default_setup_flow(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): - Flow = apps.get_model("authentik_flows", "Flow") - FlowStageBinding = apps.get_model("authentik_flows", "FlowStageBinding") - - AuthenticatorDuoStage = apps.get_model( - "authentik_stages_authenticator_duo", "AuthenticatorDuoStage" - ) - - db_alias = schema_editor.connection.alias - - flow, _ = Flow.objects.using(db_alias).update_or_create( - slug="default-authenticator-duo-setup", - designation=FlowDesignation.STAGE_CONFIGURATION, - defaults={ - "name": "default-authenticator-duo-setup", - "title": "Setup Duo", - }, - ) - - stage, _ = AuthenticatorDuoStage.objects.using(db_alias).update_or_create( - name="default-authenticator-duo-setup" - ) - - FlowStageBinding.objects.using(db_alias).update_or_create( - target=flow, stage=stage, defaults={"order": 0} - ) - - for stage in AuthenticatorDuoStage.objects.using(db_alias).filter( - configure_flow=None - ): - stage.configure_flow = flow - stage.save() class Migration(migrations.Migration): @@ -50,6 +12,4 @@ class Migration(migrations.Migration): ), ] - operations = [ - migrations.RunPython(create_default_setup_flow), - ] + operations = [] diff --git a/authentik/stages/identification/stage.py b/authentik/stages/identification/stage.py index dae45e0a0..ba885d601 100644 --- a/authentik/stages/identification/stage.py +++ b/authentik/stages/identification/stage.py @@ -9,12 +9,7 @@ from django.http import HttpResponse from django.urls import reverse from django.utils.translation import gettext as _ from drf_spectacular.utils import PolymorphicProxySerializer, extend_schema_field -from rest_framework.fields import ( - BooleanField, - CharField, - DictField, - ListField, -) +from rest_framework.fields import BooleanField, CharField, DictField, ListField from rest_framework.serializers import ValidationError from structlog.stdlib import get_logger