34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
# Generated by Django 2.2.28 on 2022-04-13 13:04
|
|
|
|
from django.db import migrations
|
|
|
|
from authentic2 import app_settings
|
|
|
|
|
|
def create_login_password_authenticator(apps, schema_editor):
|
|
kwargs_settings = getattr(app_settings, 'AUTH_FRONTENDS_KWARGS', {})
|
|
password_settings = kwargs_settings.get('password', {})
|
|
|
|
LoginPasswordAuthenticator = apps.get_model('authenticators', 'LoginPasswordAuthenticator')
|
|
LoginPasswordAuthenticator.objects.get_or_create(
|
|
slug='password-authenticator',
|
|
defaults={
|
|
'order': password_settings.get('priority', 0),
|
|
'show_condition': password_settings.get('show_condition', ''),
|
|
'enabled': app_settings.A2_AUTH_PASSWORD_ENABLE,
|
|
'remember_me': app_settings.A2_USER_REMEMBER_ME,
|
|
'include_ou_selector': app_settings.A2_LOGIN_FORM_OU_SELECTOR,
|
|
},
|
|
)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('authenticators', '0002_loginpasswordauthenticator'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(create_login_password_authenticator, reverse_code=migrations.RunPython.noop),
|
|
]
|