Projet

Général

Profil

0002-authenticators-remove-orphan-settings-with-login-pas.patch

Valentin Deniaud, 25 mai 2022 14:30

Télécharger (3,73 ko)

Voir les différences:

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(-)
src/authentic2/app_settings.py
169 169
        default=None, definition='Help text to explain validation rules of usernames'
170 170
    ),
171 171
    A2_USERNAME_IS_UNIQUE=Setting(default=True, definition='Check username uniqueness'),
172
    A2_LOGIN_FORM_OU_SELECTOR=Setting(
173
        default=False, definition='Whether to add an OU selector to the login form'
174
    ),
175 172
    A2_LOGIN_FORM_OU_SELECTOR_LABEL=Setting(default=None, definition='Label of OU field on login page'),
176 173
    A2_REGISTRATION_USERNAME_IS_UNIQUE=Setting(
177 174
        default=True, definition='Check username uniqueness on registration'
......
207 204
    A2_PASSWORD_POLICY_SHOW_LAST_CHAR=Setting(
208 205
        default=False, definition='Show last character in password fields'
209 206
    ),
210
    A2_AUTH_PASSWORD_ENABLE=Setting(
211
        default=True, definition='Activate login/password authentication', names=('AUTH_PASSWORD',)
212
    ),
213 207
    A2_SUGGESTED_EMAIL_DOMAINS=Setting(
214 208
        default=[
215 209
            'gmail.com',
......
282 276
            'Exclusion filter (as in QuerySet.exclude() to apply to User queryset before authentication'
283 277
        ),
284 278
    ),
285
    A2_USER_REMEMBER_ME=Setting(
286
        default=None,
287
        definition=(
288
            'Session duration as seconds when using the remember me checkbox. Truthiness activates the'
289
            ' checkbox.'
290
        ),
291
    ),
292 279
    A2_LOGIN_REDIRECT_AUTHENTICATED_USERS_TO_HOMEPAGE=Setting(
293 280
        default=False, definition='Redirect authenticated users to homepage'
294 281
    ),
src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py
1 1
# Generated by Django 2.2.28 on 2022-04-13 13:04
2 2

  
3
from django.conf import settings
3 4
from django.db import migrations
4 5

  
5
from authentic2 import app_settings
6

  
7 6

  
8 7
def create_login_password_authenticator(apps, schema_editor):
9
    kwargs_settings = getattr(app_settings, 'AUTH_FRONTENDS_KWARGS', {})
8
    kwargs_settings = getattr(settings, 'AUTH_FRONTENDS_KWARGS', {})
10 9
    password_settings = kwargs_settings.get('password', {})
11 10

  
12 11
    LoginPasswordAuthenticator = apps.get_model('authenticators', 'LoginPasswordAuthenticator')
......
15 14
        defaults={
16 15
            'order': password_settings.get('priority', 0),
17 16
            'show_condition': password_settings.get('show_condition') or '',
18
            'enabled': app_settings.A2_AUTH_PASSWORD_ENABLE,
19
            'remember_me': app_settings.A2_USER_REMEMBER_ME,
20
            'include_ou_selector': app_settings.A2_LOGIN_FORM_OU_SELECTOR,
17
            'enabled': getattr(settings, 'A2_AUTH_PASSWORD_ENABLE', True),
18
            'remember_me': getattr(settings, 'A2_USER_REMEMBER_ME', None),
19
            'include_ou_selector': getattr(settings, 'A2_LOGIN_FORM_OU_SELECTOR', False),
21 20
        },
22 21
    )
23 22

  
24
-