From dfbf3ac3f0197a53b2647cc704b2f4353eb68ea4 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Wed, 25 May 2022 14:24:32 +0200 Subject: [PATCH 2/2] authenticators: remove orphan settings with login password migration (#65707) --- src/authentic2/app_settings.py | 13 ------------- .../migrations/0003_auto_20220413_1504.py | 11 +++++------ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/authentic2/app_settings.py b/src/authentic2/app_settings.py index 584e0e37d..7e437ba95 100644 --- a/src/authentic2/app_settings.py +++ b/src/authentic2/app_settings.py @@ -169,9 +169,6 @@ default_settings = dict( default=None, definition='Help text to explain validation rules of usernames' ), A2_USERNAME_IS_UNIQUE=Setting(default=True, definition='Check username uniqueness'), - A2_LOGIN_FORM_OU_SELECTOR=Setting( - default=False, definition='Whether to add an OU selector to the login form' - ), A2_LOGIN_FORM_OU_SELECTOR_LABEL=Setting(default=None, definition='Label of OU field on login page'), A2_REGISTRATION_USERNAME_IS_UNIQUE=Setting( default=True, definition='Check username uniqueness on registration' @@ -207,9 +204,6 @@ default_settings = dict( A2_PASSWORD_POLICY_SHOW_LAST_CHAR=Setting( default=False, definition='Show last character in password fields' ), - A2_AUTH_PASSWORD_ENABLE=Setting( - default=True, definition='Activate login/password authentication', names=('AUTH_PASSWORD',) - ), A2_SUGGESTED_EMAIL_DOMAINS=Setting( default=[ 'gmail.com', @@ -282,13 +276,6 @@ default_settings = dict( 'Exclusion filter (as in QuerySet.exclude() to apply to User queryset before authentication' ), ), - A2_USER_REMEMBER_ME=Setting( - default=None, - definition=( - 'Session duration as seconds when using the remember me checkbox. Truthiness activates the' - ' checkbox.' - ), - ), A2_LOGIN_REDIRECT_AUTHENTICATED_USERS_TO_HOMEPAGE=Setting( default=False, definition='Redirect authenticated users to homepage' ), diff --git a/src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py b/src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py index ef7b53422..7e0073ad0 100644 --- a/src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py +++ b/src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py @@ -1,12 +1,11 @@ # Generated by Django 2.2.28 on 2022-04-13 13:04 +from django.conf import settings 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', {}) + kwargs_settings = getattr(settings, 'AUTH_FRONTENDS_KWARGS', {}) password_settings = kwargs_settings.get('password', {}) LoginPasswordAuthenticator = apps.get_model('authenticators', 'LoginPasswordAuthenticator') @@ -15,9 +14,9 @@ def create_login_password_authenticator(apps, schema_editor): defaults={ 'order': password_settings.get('priority', 0), 'show_condition': password_settings.get('show_condition') or '', - '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, + 'enabled': getattr(settings, 'A2_AUTH_PASSWORD_ENABLE', True), + 'remember_me': getattr(settings, 'A2_USER_REMEMBER_ME', None), + 'include_ou_selector': getattr(settings, 'A2_LOGIN_FORM_OU_SELECTOR', False), }, ) -- 2.30.2