PMExtra / sentry-auth-ldap

A Sentry extension to add an LDAP server as an authention source.
Apache License 2.0
27 stars 7 forks source link

Fix missing User object for UserEmail creation #2

Closed Dherlou closed 2 years ago

Dherlou commented 2 years ago

(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.

PMExtra commented 2 years ago

Sorry, It's my oversight. Thanks for your contribution.