-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create_ticket_cc generates MultipleObjectsReturned Exception when multiple users have same email address #1096
Comments
The right route to go will depend on whether it makes sense to have multiple users records with the same email address. If we made the email address unique then we could provide an upgrade script that searches for and modifies the 2nd and subsequent duplicate email addresses with a numeric number something like below: |
Would making the email address unique be limited to the HelpDesk App? I guess so, and would that then mean having a customised auth.user? |
Unfortunately it would affect all other apps within the same Django project since they all must use the same User object for authentication to work. That may have undesirable consequences in that the user would have to be logged in against the user record that was first in the list to see it. Otherwise it relies on sending an email to that email address and the user will have to figure which account to login as to see it. The only other way is to simply log an error message if there is more than 1 user recrod matching the email and not add any tocket for it. |
Perhaps the simplest option is to add a hook into the save signal on the user model and check for duplicated email addresses manually. We could log a warning to the log system that it has consequences and then at least the issue is notified. We could send an email to the user when it is detected. |
The create_ticket_cc function attempts to build a User instance based on the cc email address. However, if there happens to be more than one use registered in Django that has the same email address, this function fails and if this is being actioned from a scheduled task monitoring for email tickets there is the potential for it to block any following email tickets from being processed.
Error occurs at line 485 in email.py
The quick fix was to find the users with the same email address (one was a test user) and either delete them or adjust the email address to be unique. The Django user entry seems to allow duplicate email addresses.
Alternative fix is to monitor for multiple results and respond accordingly and to somehow park the inbound email so that it is no processed again until a unique email address can be sorted out.
The text was updated successfully, but these errors were encountered: