Projet

Général

Profil

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

Benjamin Dauvergne, 03 février 2021 21:26

Télécharger (1,36 ko)

Voir les différences:

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

 src/authentic2_auth_saml/adapters.py | 4 ++++
 1 file changed, 4 insertions(+)
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, _('SSO failed with this error: %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
-