I encountered an issue when sentry overwrites User.username field after setting a primary email, which is unwanted in some cases.
I use sentry integrated with LDAP server and the authentication based on usernames (doesn’t contain emails at all), so such change breaks the user access.
For example, the case
- User account is created automatically based on ldap info on first login
- After that the user sets a primary email
- He accidentally can’t be authenticated next time due to described behavior
Here is the code which does that.
I would expect that setting primary email will change only the User.email field. Is it really necessary to overwrite username with an email?
It would be nice to sort it out. Thanks in advance.