diff --git a/authentik/core/types.py b/authentik/core/types.py index 974c386d5..1f9ff8223 100644 --- a/authentik/core/types.py +++ b/authentik/core/types.py @@ -1,10 +1,10 @@ """authentik core dataclasses""" from dataclasses import dataclass from typing import Optional -from rest_framework.fields import CharField -from rest_framework.serializers import Serializer from django.db.models.base import Model +from rest_framework.fields import CharField +from rest_framework.serializers import Serializer @dataclass diff --git a/authentik/flows/migrations/0008_default_flows.py b/authentik/flows/migrations/0008_default_flows.py index 50b27bb40..9d5738eb0 100644 --- a/authentik/flows/migrations/0008_default_flows.py +++ b/authentik/flows/migrations/0008_default_flows.py @@ -5,7 +5,7 @@ from django.db import migrations from django.db.backends.base.schema import BaseDatabaseSchemaEditor from authentik.flows.models import FlowDesignation -from authentik.stages.identification.models import Templates, UserFields +from authentik.stages.identification.models import UserFields def create_default_authentication_flow( @@ -26,7 +26,7 @@ def create_default_authentication_flow( name="default-authentication-identification", defaults={ "user_fields": [UserFields.E_MAIL, UserFields.USERNAME], - "template": Templates.DEFAULT_LOGIN, + "template": "", }, ) diff --git a/authentik/stages/identification/api.py b/authentik/stages/identification/api.py index 677467b70..1e3e70aab 100644 --- a/authentik/stages/identification/api.py +++ b/authentik/stages/identification/api.py @@ -15,7 +15,6 @@ class IdentificationStageSerializer(StageSerializer): "user_fields", "case_insensitive_matching", "show_matched_user", - "template", "enrollment_flow", "recovery_flow", ] diff --git a/authentik/stages/identification/forms.py b/authentik/stages/identification/forms.py index fb3678f70..29e9f37b0 100644 --- a/authentik/stages/identification/forms.py +++ b/authentik/stages/identification/forms.py @@ -1,12 +1,9 @@ """authentik flows identification forms""" from django import forms -from django.core.validators import validate_email -from django.utils.translation import gettext_lazy as _ from structlog.stdlib import get_logger from authentik.admin.fields import ArrayFieldSelectMultiple from authentik.flows.models import Flow, FlowDesignation -from authentik.lib.utils.ui import human_list from authentik.stages.identification.models import IdentificationStage, UserFields LOGGER = get_logger() @@ -32,7 +29,6 @@ class IdentificationStageForm(forms.ModelForm): "user_fields", "case_insensitive_matching", "show_matched_user", - "template", "enrollment_flow", "recovery_flow", ] diff --git a/authentik/stages/identification/migrations/0007_remove_identificationstage_template.py b/authentik/stages/identification/migrations/0007_remove_identificationstage_template.py new file mode 100644 index 000000000..953ba7919 --- /dev/null +++ b/authentik/stages/identification/migrations/0007_remove_identificationstage_template.py @@ -0,0 +1,20 @@ +# Generated by Django 3.1.6 on 2021-02-20 22:46 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "authentik_stages_identification", + "0006_identificationstage_show_matched_user", + ), + ] + + operations = [ + migrations.RemoveField( + model_name="identificationstage", + name="template", + ), + ] diff --git a/authentik/stages/identification/models.py b/authentik/stages/identification/models.py index cf6513e97..88b20a966 100644 --- a/authentik/stages/identification/models.py +++ b/authentik/stages/identification/models.py @@ -18,13 +18,6 @@ class UserFields(models.TextChoices): USERNAME = "username" -class Templates(models.TextChoices): - """Templates to be used for the stage""" - - DEFAULT_LOGIN = "stages/identification/login.html" - DEFAULT_RECOVERY = "stages/identification/recovery.html" - - class IdentificationStage(Stage): """Allows the user to identify themselves for authentication.""" @@ -37,7 +30,6 @@ class IdentificationStage(Stage): ) ), ) - template = models.TextField(choices=Templates.choices) case_insensitive_matching = models.BooleanField( default=True, diff --git a/authentik/stages/identification/stage.py b/authentik/stages/identification/stage.py index a05c7e802..bb7406a9e 100644 --- a/authentik/stages/identification/stage.py +++ b/authentik/stages/identification/stage.py @@ -1,5 +1,4 @@ """Identification stage logic""" -from authentik.core.types import UILoginButtonSerializer from dataclasses import asdict from typing import Optional @@ -13,6 +12,7 @@ from structlog.stdlib import get_logger from authentik.core.api.applications import ApplicationSerializer from authentik.core.models import Source, User +from authentik.core.types import UILoginButtonSerializer from authentik.flows.challenge import Challenge, ChallengeResponse, ChallengeTypes from authentik.flows.planner import PLAN_CONTEXT_PENDING_USER from authentik.flows.stage import ( diff --git a/authentik/stages/identification/templates/stages/identification/login.html b/authentik/stages/identification/templates/stages/identification/login.html deleted file mode 100644 index 54eb7812a..000000000 --- a/authentik/stages/identification/templates/stages/identification/login.html +++ /dev/null @@ -1,61 +0,0 @@ -{% load i18n %} -{% load static %} - -
-

- {% block card_title %} - {% trans title %} - {% endblock %} -

-
-
-
- {% block above_form %} - {% if application_pre %} -

- {% blocktrans with app_name=application_pre.name %} - Login to continue to {{ app_name }}. - {% endblocktrans %} -

- {% endif %} - {% endblock %} - - {% include 'partials/form.html' %} - - {% block beneath_form %} - {% endblock %} -
- -
-
-
- diff --git a/authentik/stages/identification/templates/stages/identification/recovery.html b/authentik/stages/identification/templates/stages/identification/recovery.html deleted file mode 100644 index 5603b0414..000000000 --- a/authentik/stages/identification/templates/stages/identification/recovery.html +++ /dev/null @@ -1,28 +0,0 @@ -{% load i18n %} - -
-

- {% trans 'Trouble Logging In?' %} -

-
-
- {% block card %} -
- {% block above_form %} - {% endblock %} - - {% include 'partials/form.html' %} - - {% block beneath_form %} - {% endblock %} -
- -
-
- {% endblock %} -
- diff --git a/authentik/stages/identification/tests.py b/authentik/stages/identification/tests.py index 8c2ea99d9..66f85f489 100644 --- a/authentik/stages/identification/tests.py +++ b/authentik/stages/identification/tests.py @@ -6,11 +6,7 @@ from django.utils.encoding import force_str from authentik.core.models import User from authentik.flows.models import Flow, FlowDesignation, FlowStageBinding from authentik.sources.oauth.models import OAuthSource -from authentik.stages.identification.models import ( - IdentificationStage, - Templates, - UserFields, -) +from authentik.stages.identification.models import IdentificationStage, UserFields class TestIdentificationStage(TestCase): @@ -29,7 +25,6 @@ class TestIdentificationStage(TestCase): self.stage = IdentificationStage.objects.create( name="identification", user_fields=[UserFields.E_MAIL], - template=Templates.DEFAULT_LOGIN, ) FlowStageBinding.objects.create( target=self.flow,