From 9f685c5da6b7eb0737efe8183e161970ace0a106 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 3 Jan 2024 19:07:55 +0100 Subject: [PATCH] fix friendly name not allowing blank, fix static authenticator stage's name Signed-off-by: Jens Langhammer --- authentik/flows/models.py | 2 +- ...005_authenticatorduostage_friendly_name.py | 2 +- .../stages/authenticator_mobile/api/device.py | 2 +- .../migrations/0001_initial.py | 2 +- ...006_authenticatorsmsstage_friendly_name.py | 2 +- ..._authenticatorstaticstage_friendly_name.py | 2 +- ..._alter_authenticatorstaticstage_options.py | 19 +++++++++++++++++++ .../stages/authenticator_static/models.py | 6 +++--- ...07_authenticatortotpstage_friendly_name.py | 2 +- ...authenticatewebauthnstage_friendly_name.py | 2 +- 10 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 authentik/stages/authenticator_static/migrations/0010_alter_authenticatorstaticstage_options.py diff --git a/authentik/flows/models.py b/authentik/flows/models.py index 7ed744824..639d8093b 100644 --- a/authentik/flows/models.py +++ b/authentik/flows/models.py @@ -276,7 +276,7 @@ class ConfigurableStage(models.Model): class FriendlyNamedStage(models.Model): """Abstract base class for a Stage that can have a user friendly name configured.""" - friendly_name = models.TextField(null=True) + friendly_name = models.TextField(null=True, blank=True) class Meta: abstract = True diff --git a/authentik/stages/authenticator_duo/migrations/0005_authenticatorduostage_friendly_name.py b/authentik/stages/authenticator_duo/migrations/0005_authenticatorduostage_friendly_name.py index 3367dd4fa..676056478 100644 --- a/authentik/stages/authenticator_duo/migrations/0005_authenticatorduostage_friendly_name.py +++ b/authentik/stages/authenticator_duo/migrations/0005_authenticatorduostage_friendly_name.py @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="authenticatorduostage", name="friendly_name", - field=models.TextField(null=True), + field=models.TextField(null=True, blank=True), ), ] diff --git a/authentik/stages/authenticator_mobile/api/device.py b/authentik/stages/authenticator_mobile/api/device.py index 072534d22..9ecc8aedb 100644 --- a/authentik/stages/authenticator_mobile/api/device.py +++ b/authentik/stages/authenticator_mobile/api/device.py @@ -5,7 +5,7 @@ from django_filters.rest_framework.backends import DjangoFilterBackend from drf_spectacular.utils import OpenApiResponse, extend_schema, inline_serializer from rest_framework import mixins from rest_framework.decorators import action -from rest_framework.fields import CharField, ChoiceField, JSONField, UUIDField, DateTimeField +from rest_framework.fields import CharField, ChoiceField, DateTimeField, JSONField, UUIDField from rest_framework.filters import OrderingFilter, SearchFilter from rest_framework.permissions import IsAdminUser from rest_framework.request import Request diff --git a/authentik/stages/authenticator_mobile/migrations/0001_initial.py b/authentik/stages/authenticator_mobile/migrations/0001_initial.py index c12bf8e66..f5e2c92db 100644 --- a/authentik/stages/authenticator_mobile/migrations/0001_initial.py +++ b/authentik/stages/authenticator_mobile/migrations/0001_initial.py @@ -33,7 +33,7 @@ class Migration(migrations.Migration): to="authentik_flows.stage", ), ), - ("friendly_name", models.TextField(null=True)), + ("friendly_name", models.TextField(null=True, blank=True)), ( "item_matching_mode", models.TextField( diff --git a/authentik/stages/authenticator_sms/migrations/0006_authenticatorsmsstage_friendly_name.py b/authentik/stages/authenticator_sms/migrations/0006_authenticatorsmsstage_friendly_name.py index de2d36b96..1046e9ecb 100644 --- a/authentik/stages/authenticator_sms/migrations/0006_authenticatorsmsstage_friendly_name.py +++ b/authentik/stages/authenticator_sms/migrations/0006_authenticatorsmsstage_friendly_name.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="authenticatorsmsstage", name="friendly_name", - field=models.TextField(null=True), + field=models.TextField(null=True, blank=True), ), ] diff --git a/authentik/stages/authenticator_static/migrations/0006_authenticatorstaticstage_friendly_name.py b/authentik/stages/authenticator_static/migrations/0006_authenticatorstaticstage_friendly_name.py index 89ab51d15..a043f1072 100644 --- a/authentik/stages/authenticator_static/migrations/0006_authenticatorstaticstage_friendly_name.py +++ b/authentik/stages/authenticator_static/migrations/0006_authenticatorstaticstage_friendly_name.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="authenticatorstaticstage", name="friendly_name", - field=models.TextField(null=True), + field=models.TextField(null=True, blank=True), ), ] diff --git a/authentik/stages/authenticator_static/migrations/0010_alter_authenticatorstaticstage_options.py b/authentik/stages/authenticator_static/migrations/0010_alter_authenticatorstaticstage_options.py new file mode 100644 index 000000000..b33653ec9 --- /dev/null +++ b/authentik/stages/authenticator_static/migrations/0010_alter_authenticatorstaticstage_options.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0 on 2024-01-03 18:07 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("authentik_stages_authenticator_static", "0009_throttling"), + ] + + operations = [ + migrations.AlterModelOptions( + name="authenticatorstaticstage", + options={ + "verbose_name": "Static Authenticator Setup Stage", + "verbose_name_plural": "Static Authenticator Setup Stages", + }, + ), + ] diff --git a/authentik/stages/authenticator_static/models.py b/authentik/stages/authenticator_static/models.py index 7ce345159..3b1ade629 100644 --- a/authentik/stages/authenticator_static/models.py +++ b/authentik/stages/authenticator_static/models.py @@ -46,11 +46,11 @@ class AuthenticatorStaticStage(ConfigurableStage, FriendlyNamedStage, Stage): ) def __str__(self) -> str: - return f"Static Authenticator Stage {self.name}" + return f"Static Authenticator Setup Stage {self.name}" class Meta: - verbose_name = _("Static Authenticator Stage") - verbose_name_plural = _("Static Authenticator Stages") + verbose_name = _("Static Authenticator Setup Stage") + verbose_name_plural = _("Static Authenticator Setup Stages") class StaticDevice(SerializerModel, ThrottlingMixin, Device): diff --git a/authentik/stages/authenticator_totp/migrations/0007_authenticatortotpstage_friendly_name.py b/authentik/stages/authenticator_totp/migrations/0007_authenticatortotpstage_friendly_name.py index 5568657d6..b9726a081 100644 --- a/authentik/stages/authenticator_totp/migrations/0007_authenticatortotpstage_friendly_name.py +++ b/authentik/stages/authenticator_totp/migrations/0007_authenticatortotpstage_friendly_name.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="authenticatortotpstage", name="friendly_name", - field=models.TextField(null=True), + field=models.TextField(null=True, blank=True), ), ] diff --git a/authentik/stages/authenticator_webauthn/migrations/0009_authenticatewebauthnstage_friendly_name.py b/authentik/stages/authenticator_webauthn/migrations/0009_authenticatewebauthnstage_friendly_name.py index 2f51f3438..4827e5f56 100644 --- a/authentik/stages/authenticator_webauthn/migrations/0009_authenticatewebauthnstage_friendly_name.py +++ b/authentik/stages/authenticator_webauthn/migrations/0009_authenticatewebauthnstage_friendly_name.py @@ -12,6 +12,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="authenticatewebauthnstage", name="friendly_name", - field=models.TextField(null=True), + field=models.TextField(null=True, blank=True), ), ]