Projet

Général

Profil

0001-auth_saml-report-mapping-errors-to-users-50834.patch

Benjamin Dauvergne, 04 février 2021 10:06

Télécharger (2,29 ko)

Voir les différences:

Subject: [PATCH] auth_saml: report mapping errors to users (#50834)

 debian/control                       | 3 ++-
 setup.py                             | 2 +-
 src/authentic2_auth_saml/adapters.py | 4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)
debian/control
39 39
    python3-chardet,
40 40
    python3-attr (>=17),
41 41
    python3-pycryptodome,
42
    python3-atomicwrites
42
    python3-atomicwrites,
43
    python3-django-mellon>=1.22
43 44
Conflicts: python-authentic2
44 45
Replaces: python-authentic2
45 46
Description: Versatile identity server
setup.py
131 131
          'python-ldap',
132 132
          'django-filter>1,<2.3',
133 133
          'pycryptodomex',
134
          'django-mellon',
134
          'django-mellon>=1.22',
135 135
          'ldaptools',
136 136
          'jwcrypto>=0.3.1,<1',
137 137
          'cryptography',
src/authentic2_auth_saml/adapters.py
19 19
import logging
20 20

  
21 21
from django.utils import six
22
from django.contrib import messages
22 23
from django.core.exceptions import MultipleObjectsReturned
23 24
from django.db.transaction import atomic
25
from django.utils.translation import ugettext as _
24 26

  
25 27
from mellon.adapters import DefaultAdapter, UserCreationError
26 28
from mellon.utils import get_setting
......
74 76
        try:
75 77
            self.provision_a2_attributes(user, idp, saml_attributes)
76 78
        except MappingError as e:
79
            if self.request:
80
                messages.error(self.request, _('user creation failed on a mandatory mapping action: %s') % e)
77 81
            raise UserCreationError('user creation failed on a mandatory mapping action: %s' % e)
78 82
        if not user.ou:
79 83
            user.ou = get_default_ou()
80
-