0001-authenticators-adjust-show_condition-field-contraint.patch
src/authentic2/apps/authenticators/migrations/0001_initial.py | ||
---|---|---|
32 | 32 |
'show_condition', |
33 | 33 |
models.CharField( |
34 | 34 |
blank=True, |
35 |
default='', |
|
35 | 36 |
help_text=( |
36 | 37 |
'Django template controlling authenticator display. For example, "\'backoffice\' ' |
37 | 38 |
'in login_hint or remotre_addr == \'1.2.3.4\'" would hide the authenticator from ' |
... | ... | |
39 | 40 |
'variables include service_ou_slug, service_slug, remote_addr, login_hint and ' |
40 | 41 |
'headers.' |
41 | 42 |
), |
42 |
max_length=128,
|
|
43 |
max_length=1024,
|
|
43 | 44 |
verbose_name='Show condition', |
44 | 45 |
), |
45 | 46 |
), |
src/authentic2/apps/authenticators/migrations/0003_auto_20220413_1504.py | ||
---|---|---|
14 | 14 |
slug='password-authenticator', |
15 | 15 |
defaults={ |
16 | 16 |
'order': password_settings.get('priority', 0), |
17 |
'show_condition': password_settings.get('show_condition', ''),
|
|
17 |
'show_condition': password_settings.get('show_condition') or '',
|
|
18 | 18 |
'enabled': app_settings.A2_AUTH_PASSWORD_ENABLE, |
19 | 19 |
'remember_me': app_settings.A2_USER_REMEMBER_ME, |
20 | 20 |
'include_ou_selector': app_settings.A2_LOGIN_FORM_OU_SELECTOR, |
src/authentic2/apps/authenticators/models.py | ||
---|---|---|
46 | 46 |
enabled = models.BooleanField(default=False, editable=False) |
47 | 47 |
show_condition = models.CharField( |
48 | 48 |
_('Show condition'), |
49 |
max_length=128,
|
|
49 |
max_length=1024,
|
|
50 | 50 |
blank=True, |
51 |
default='', |
|
51 | 52 |
help_text=_( |
52 | 53 |
'Django template controlling authenticator display. For example, "\'backoffice\' in ' |
53 | 54 |
'login_hint or remotre_addr == \'1.2.3.4\'" would hide the authenticator from normal users ' |
src/authentic2_auth_oidc/migrations/0010_auto_20220413_1622.py | ||
---|---|---|
10 | 10 |
def add_base_authenticators(apps, schema_editor): |
11 | 11 |
kwargs_settings = getattr(global_settings, 'AUTH_FRONTENDS_KWARGS', {}) |
12 | 12 |
oidc_provider_settings = kwargs_settings.get('oidc', {}) |
13 |
show_condition = oidc_provider_settings.get('show_condition') |
|
13 |
show_condition = oidc_provider_settings.get('show_condition') or ''
|
|
14 | 14 | |
15 | 15 |
BaseAuthenticator = apps.get_model('authenticators', 'BaseAuthenticator') |
16 | 16 |
OIDCProvider = apps.get_model('authentic2_auth_oidc', 'OIDCProvider') |
17 | 17 | |
18 | 18 |
for provider in OIDCProvider.objects.all(): |
19 | 19 |
if isinstance(show_condition, dict): |
20 |
show_condition = show_condition.get(provider.slug, '')
|
|
20 |
show_condition = show_condition.get(provider.slug) or ''
|
|
21 | 21 | |
22 | 22 |
base_authenticator = BaseAuthenticator.objects.create( |
23 | 23 |
name=provider.name, |
24 |
- |