Projet

Général

Profil

0001-authenticators-add-login-form-customization-fields-5.patch

Valentin Deniaud, 27 juillet 2022 10:57

Télécharger (3,57 ko)

Voir les différences:

Subject: [PATCH 1/4] authenticators: add login form customization fields
 (#51363)

 .../migrations/0004_auto_20220726_1708.py     | 28 +++++++++++++++++++
 src/authentic2/apps/authenticators/models.py  |  9 ++++++
 src/authentic2_auth_fc/forms.py               |  2 +-
 tests/test_manager_authenticators.py          |  2 ++
 4 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 src/authentic2/apps/authenticators/migrations/0004_auto_20220726_1708.py
src/authentic2/apps/authenticators/migrations/0004_auto_20220726_1708.py
1
# Generated by Django 2.2.26 on 2022-07-26 15:08
2

  
3
from django.db import migrations, models
4

  
5

  
6
class Migration(migrations.Migration):
7

  
8
    dependencies = [
9
        ('authenticators', '0003_auto_20220413_1504'),
10
    ]
11

  
12
    operations = [
13
        migrations.AddField(
14
            model_name='baseauthenticator',
15
            name='button_description',
16
            field=models.CharField(
17
                blank=True,
18
                help_text='Description will be shown on login page above login button (unless already set by theme).',
19
                max_length=256,
20
                verbose_name='Login button description',
21
            ),
22
        ),
23
        migrations.AddField(
24
            model_name='baseauthenticator',
25
            name='button_label',
26
            field=models.CharField(default='Login', max_length=64, verbose_name='Login button label'),
27
        ),
28
    ]
src/authentic2/apps/authenticators/models.py
58 58
            'service_ou_slug, service_slug, remote_addr, login_hint and headers.'
59 59
        ),
60 60
    )
61
    button_description = models.CharField(
62
        _('Login button description'),
63
        max_length=256,
64
        blank=True,
65
        help_text=_(
66
            'Description will be shown on login page above login button (unless already set by theme).'
67
        ),
68
    )
69
    button_label = models.CharField(_('Login button label'), max_length=64, default=_('Login'))
61 70

  
62 71
    objects = models.Manager()
63 72
    authenticators = AuthenticatorManager()
src/authentic2_auth_fc/forms.py
32 32

  
33 33
    class Meta:
34 34
        model = FcAuthenticator
35
        exclude = ('name', 'slug', 'ou')
35
        exclude = ('name', 'slug', 'ou', 'button_description', 'button_label')
tests/test_manager_authenticators.py
56 56
    assert list(resp.form.fields) == [
57 57
        'csrfmiddlewaretoken',
58 58
        'show_condition',
59
        'button_description',
60
        'button_label',
59 61
        'remember_me',
60 62
        'include_ou_selector',
61 63
        None,
62
-