stages/identification: minor UI fixes

This commit is contained in:
Jens Langhammer 2020-06-05 17:02:50 +02:00
parent b0f426e51a
commit 0c5aff21bc
4 changed files with 16 additions and 9 deletions

View File

@ -1,5 +1,6 @@
"""passbook flows identification forms""" """passbook flows identification forms"""
from django import forms from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.core.validators import validate_email from django.core.validators import validate_email
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from structlog import get_logger from structlog import get_logger
@ -19,6 +20,9 @@ class IdentificationStageForm(forms.ModelForm):
fields = ["name", "user_fields", "template", "enrollment_flow", "recovery_flow"] fields = ["name", "user_fields", "template", "enrollment_flow", "recovery_flow"]
widgets = { widgets = {
"name": forms.TextInput(), "name": forms.TextInput(),
"user_fields": FilteredSelectMultiple(
_("fields"), False, choices=UserFields.choices
),
} }

View File

@ -48,7 +48,7 @@ class IdentificationStage(Stage):
related_name="+", related_name="+",
default=None, default=None,
help_text=_( help_text=_(
"Optional enrollment flow, which is linked at the bottom of the page." "Optional recovery flow, which is linked at the bottom of the page."
), ),
) )

View File

@ -1,20 +1,23 @@
"""passbook administration forms""" """passbook administration forms"""
from django import forms from django import forms
from django.conf import settings
from django.contrib.admin.widgets import FilteredSelectMultiple from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from passbook.lib.utils.reflection import path_to_class
from passbook.stages.password.models import PasswordStage from passbook.stages.password.models import PasswordStage
def get_authentication_backends(): def get_authentication_backends():
"""Return all available authentication backends as tuple set""" """Return all available authentication backends as tuple set"""
for backend in settings.AUTHENTICATION_BACKENDS: return [
klass = path_to_class(backend) (
yield backend, getattr( "django.contrib.auth.backends.ModelBackend",
klass(), "name", "%s (%s)" % (klass.__name__, klass.__module__) _("passbook-internal Userdatabase"),
) ),
(
"passbook.sources.ldap.auth.LDAPBackend",
_("passbook LDAP (Only needed when User-Sync is not enabled."),
),
]
class PasswordForm(forms.Form): class PasswordForm(forms.Form):

View File

@ -5927,7 +5927,7 @@ definitions:
x-nullable: true x-nullable: true
recovery_flow: recovery_flow:
title: Recovery flow title: Recovery flow
description: Optional enrollment flow, which is linked at the bottom of the description: Optional recovery flow, which is linked at the bottom of the
page. page.
type: string type: string
format: uuid format: uuid