From 39907c39d342f240172cf41fe7cc9f939a544bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20L=C3=B3pez?= Date: Thu, 20 Jun 2019 15:46:22 -0700 Subject: [PATCH] username field reference fix --- django_saml2_auth/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django_saml2_auth/views.py b/django_saml2_auth/views.py index 865c112..374b6f1 100644 --- a/django_saml2_auth/views.py +++ b/django_saml2_auth/views.py @@ -180,7 +180,7 @@ def acs(r): is_new_user = False try: - target_user = User.objects.get(username=user_name) + target_user = User.objects.get(**{User.USERNAME_FIELD: user_name}) if settings.SAML2_AUTH.get('TRIGGER', {}).get('BEFORE_LOGIN', None): import_string(settings.SAML2_AUTH['TRIGGER']['BEFORE_LOGIN'])(user_identity) except User.DoesNotExist: