Skip to content

Commit

Permalink
Pass the user object to hooks methods — See fangli#163
Browse files Browse the repository at this point in the history
  • Loading branch information
tchaumeny committed Jun 28, 2021
1 parent 825c109 commit 720dfcc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_saml2_auth/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ def acs(r):
try:
target_user = User.objects.get(username=user_name)
if settings.SAML2_AUTH.get('TRIGGER', {}).get('BEFORE_LOGIN', None):
import_string(settings.SAML2_AUTH['TRIGGER']['BEFORE_LOGIN'])(user_identity)
import_string(settings.SAML2_AUTH['TRIGGER']['BEFORE_LOGIN'])(user_identity, target_user)
except User.DoesNotExist:
new_user_should_be_created = settings.SAML2_AUTH.get('CREATE_USER', True)
if new_user_should_be_created:
target_user = _create_new_user(user_name, user_email, user_first_name, user_last_name)
if settings.SAML2_AUTH.get('TRIGGER', {}).get('CREATE_USER', None):
import_string(settings.SAML2_AUTH['TRIGGER']['CREATE_USER'])(user_identity)
import_string(settings.SAML2_AUTH['TRIGGER']['CREATE_USER'])(user_identity, target_user)
is_new_user = True
else:
return HttpResponseRedirect(get_reverse([denied, 'denied', 'django_saml2_auth:denied']))
Expand Down

0 comments on commit 720dfcc

Please sign in to comment.