(I don't know, if this is the cleanest fix, but this is what is working for me, at least.)
Without the user.save() call prior to UserEMail.objects.get_or_create, I got the following exception, when logging in with a new ldap account:
sentry.models.useremail.UserEmail.DoesNotExist: UserEmail matching query does not exist.
This results from the UserEmail table referencing the new User object, which has not been persisted to database yet.
(I don't know, if this is the cleanest fix, but this is what is working for me, at least.)
Without the
user.save()
call prior toUserEMail.objects.get_or_create
, I got the following exception, when logging in with a new ldap account:sentry.models.useremail.UserEmail.DoesNotExist: UserEmail matching query does not exist.
This results from the UserEmail table referencing the new User object, which has not been persisted to database yet.