stages/identification: remove templates
This commit is contained in:
parent
7a9140bdcd
commit
1c8d101fc3
|
@ -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
|
||||
|
|
|
@ -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": "",
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ class IdentificationStageSerializer(StageSerializer):
|
|||
"user_fields",
|
||||
"case_insensitive_matching",
|
||||
"show_matched_user",
|
||||
"template",
|
||||
"enrollment_flow",
|
||||
"recovery_flow",
|
||||
]
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
|
|
|
@ -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",
|
||||
),
|
||||
]
|
|
@ -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,
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
<header class="pf-c-login__main-header">
|
||||
<h1 class="pf-c-title pf-m-3xl">
|
||||
{% block card_title %}
|
||||
{% trans title %}
|
||||
{% endblock %}
|
||||
</h1>
|
||||
</header>
|
||||
<div class="pf-c-login__main-body">
|
||||
<form method="POST" class="pf-c-form">
|
||||
{% block above_form %}
|
||||
{% if application_pre %}
|
||||
<p>
|
||||
{% blocktrans with app_name=application_pre.name %}
|
||||
Login to continue to <strong id="application-name">{{ app_name }}</strong>.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% include 'partials/form.html' %}
|
||||
|
||||
{% block beneath_form %}
|
||||
{% endblock %}
|
||||
<div class="pf-c-form__group pf-m-action">
|
||||
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans primary_action %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<footer class="pf-c-login__main-footer">
|
||||
<ul class="pf-c-login__main-footer-links">
|
||||
{% for source in sources %}
|
||||
<li class="pf-c-login__main-footer-links-item">
|
||||
<a href="{{ source.url }}" class="pf-c-login__main-footer-links-item-link">
|
||||
{% if source.icon_url %}
|
||||
<img src="{{ source.icon_url }}" alt="{{ source.name }}">
|
||||
{% else %}
|
||||
<i class="pf-icon pf-icon-arrow" title="{{ source.name }}"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% if enroll_url or recovery_url %}
|
||||
<div class="pf-c-login__main-footer-band">
|
||||
{% if enroll_url %}
|
||||
<p class="pf-c-login__main-footer-band-item">
|
||||
{% trans 'Need an account?' %}
|
||||
<a role="enroll" href="{{ enroll_url }}">{% trans 'Sign up.' %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if recovery_url %}
|
||||
<p class="pf-c-login__main-footer-band-item">
|
||||
<a role="recovery" href="{{ recovery_url }}">{% trans 'Forgot username or password?' %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</footer>
|
|
@ -1,28 +0,0 @@
|
|||
{% load i18n %}
|
||||
|
||||
<header class="pf-c-login__main-header">
|
||||
<h1 class="pf-c-title pf-m-3xl">
|
||||
{% trans 'Trouble Logging In?' %}
|
||||
</h1>
|
||||
</header>
|
||||
<div class="pf-c-login__main-body">
|
||||
{% block card %}
|
||||
<form method="POST" class="pf-c-form">
|
||||
{% block above_form %}
|
||||
{% endblock %}
|
||||
|
||||
{% include 'partials/form.html' %}
|
||||
|
||||
{% block beneath_form %}
|
||||
{% endblock %}
|
||||
<div class="pf-c-form__group pf-m-action">
|
||||
<button class="pf-c-button pf-m-primary pf-m-block" type="submit">{% trans primary_action %}</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<footer class="pf-c-login__main-footer">
|
||||
{% if config.login.subtext %}
|
||||
<p>{{ config.login.subtext }}</p>
|
||||
{% endif %}
|
||||
</footer>
|
|
@ -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,
|
||||
|
|
Reference in New Issue