diff --git a/authentik/events/apps.py b/authentik/events/apps.py index f0eb77c9c..e033b747c 100644 --- a/authentik/events/apps.py +++ b/authentik/events/apps.py @@ -4,7 +4,7 @@ from importlib import import_module from django.apps import AppConfig from django.db import ProgrammingError -from django.utils.timezone import datetime +from django.utils.timezone import now class AuthentikEventsConfig(AppConfig): @@ -19,7 +19,7 @@ class AuthentikEventsConfig(AppConfig): try: from authentik.events.models import Event - date_from = datetime.now() - timedelta(days=1) + date_from = now() - timedelta(days=1) for event in Event.objects.filter(created__gte=date_from): event._set_prom_metrics() diff --git a/authentik/flows/challenge.py b/authentik/flows/challenge.py index f353559b5..233325eeb 100644 --- a/authentik/flows/challenge.py +++ b/authentik/flows/challenge.py @@ -35,7 +35,7 @@ class Challenge(PassiveSerializer): type = ChoiceField( choices=[(x.value, x.name) for x in ChallengeTypes], ) - title = CharField(required=False) + title = CharField(required=False, allow_blank=True) background = CharField(required=False) component = CharField(default="") diff --git a/authentik/flows/planner.py b/authentik/flows/planner.py index 718f64cfa..65f2e24cb 100644 --- a/authentik/flows/planner.py +++ b/authentik/flows/planner.py @@ -26,7 +26,7 @@ PLAN_CONTEXT_SOURCE = "source" GAUGE_FLOWS_CACHED = UpdatingGauge( "authentik_flows_cached", "Cached flows", - update_func=lambda: len(cache.keys("flow_*")), + update_func=lambda: len(cache.keys("flow_*") or []), ) HIST_FLOWS_PLAN_TIME = Histogram( "authentik_flows_plan_time", diff --git a/authentik/policies/engine.py b/authentik/policies/engine.py index 99f27b1d5..1377d8228 100644 --- a/authentik/policies/engine.py +++ b/authentik/policies/engine.py @@ -25,7 +25,7 @@ CURRENT_PROCESS = current_process() GAUGE_POLICIES_CACHED = UpdatingGauge( "authentik_policies_cached", "Cached Policies", - update_func=lambda: len(cache.keys("policy_*")), + update_func=lambda: len(cache.keys("policy_*") or []), ) HIST_POLICIES_BUILD_TIME = Histogram( "authentik_policies_build_time", diff --git a/authentik/stages/prompt/stage.py b/authentik/stages/prompt/stage.py index e818a6c52..6a90f66b1 100644 --- a/authentik/stages/prompt/stage.py +++ b/authentik/stages/prompt/stage.py @@ -33,7 +33,7 @@ class StagePromptSerializer(PassiveSerializer): label = CharField(allow_blank=True) type = CharField() required = BooleanField() - placeholder = CharField() + placeholder = CharField(allow_blank=True) order = IntegerField() diff --git a/tests/e2e/test_flows_enroll.py b/tests/e2e/test_flows_enroll.py index e1dee33bc..82a22d912 100644 --- a/tests/e2e/test_flows_enroll.py +++ b/tests/e2e/test_flows_enroll.py @@ -78,6 +78,7 @@ class TestFlowsEnroll(SeleniumTestCase): flow = Flow.objects.create( name="default-enrollment-flow", slug="default-enrollment-flow", + title="default-enrollment-flow", designation=FlowDesignation.ENROLLMENT, ) @@ -154,6 +155,7 @@ class TestFlowsEnroll(SeleniumTestCase): flow = Flow.objects.create( name="default-enrollment-flow", slug="default-enrollment-flow", + title="default-enrollment-flow", designation=FlowDesignation.ENROLLMENT, )