This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/ldap/forms.py

88 lines
2.5 KiB
Python
Raw Normal View History

2018-11-26 17:22:38 +00:00
"""passbook LDAP Forms"""
2018-11-11 12:41:48 +00:00
2018-11-26 17:22:38 +00:00
from django import forms
2019-02-21 15:06:57 +00:00
from django.utils.translation import gettext_lazy as _
2018-11-11 12:41:48 +00:00
2018-11-26 17:22:38 +00:00
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.ldap.models import LDAPSource
2018-11-11 12:41:48 +00:00
2018-11-26 17:22:38 +00:00
class LDAPSourceForm(forms.ModelForm):
"""LDAPSource Form"""
class Meta:
model = LDAPSource
fields = SOURCE_FORM_FIELDS + ['server_uri', 'bind_cn', 'bind_password',
'type', 'domain', 'base_dn', 'create_user',
2019-02-21 15:06:57 +00:00
'reset_password']
2018-11-26 21:09:04 +00:00
widgets = {
'name': forms.TextInput(),
'server_uri': forms.TextInput(),
'bind_cn': forms.TextInput(),
'bind_password': forms.TextInput(),
'domain': forms.TextInput(),
'base_dn': forms.TextInput(),
}
2019-02-21 15:06:57 +00:00
labels = {
'server_uri': _('Server URI'),
'bind_cn': _('Bind CN'),
'base_dn': _('Base DN'),
}
2018-11-26 17:22:38 +00:00
2018-11-11 12:41:48 +00:00
# class GeneralSettingsForm(SettingsForm):
# """general settings form"""
# MODE_AUTHENTICATION_BACKEND = 'auth_backend'
# MODE_CREATE_USERS = 'create_users'
# MODE_CHOICES = (
# (MODE_AUTHENTICATION_BACKEND, _('Authentication Backend')),
# (MODE_CREATE_USERS, _('Create Users'))
# )
# namespace = 'passbook.ldap'
2018-11-11 12:41:48 +00:00
# settings = ['enabled', 'mode']
# widgets = {
# 'enabled': forms.BooleanField(required=False),
# 'mode': forms.ChoiceField(widget=forms.RadioSelect, choices=MODE_CHOICES),
# }
# class ConnectionSettings(SettingsForm):
# """Connection settings form"""
# namespace = 'passbook.ldap'
2018-11-11 12:41:48 +00:00
# settings = ['server', 'server:tls', 'bind:user', 'bind:password', 'domain']
# attrs_map = {
# 'server': {'placeholder': 'dc1.corp.exmaple.com'},
# 'bind:user': {'placeholder': 'Administrator'},
# 'domain': {'placeholder': 'corp.example.com'},
# }
# widgets = {
# 'server:tls': forms.BooleanField(required=False, label=_('Server TLS')),
# }
# class AuthenticationBackendSettings(SettingsForm):
# """Authentication backend settings"""
# namespace = 'passbook.ldap'
2018-11-11 12:41:48 +00:00
# settings = ['base']
# attrs_map = {
# 'base': {'placeholder': 'DN in which to search for users'},
# }
# class CreateUsersSettings(SettingsForm):
# """Create users settings"""
# namespace = 'passbook.ldap'
2018-11-11 12:41:48 +00:00
# settings = ['create_base']
# attrs_map = {
# 'create_base': {'placeholder': 'DN in which to create users'},
# }