Skip to content
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

Gracefully handle situations where two or more users share the same email #18

Open
DavisRayM opened this issue Feb 17, 2021 · 0 comments

Comments

@DavisRayM
Copy link
Contributor

Bug

Currently during the login process if two or more accounts have the same email the authentication process fails with a 500 due to an uncaught exception.

Traceback (most recent call last):                                                                                                                                                                                                            
  File "/home/rapidpro/.virtualenvs/rapidpro/lib/python3.6/site-packages/rest_framework/views.py", line 492, in dispatch                                                                                                                      
    response = handler(request, *args, **kwargs)                                                                                                                                                                                              
  File "/home/rapidpro/.virtualenvs/rapidpro/src/ona-oidc/oidc/viewsets.py", line 175, in callback                                                                                                                                            
    user = self.user_model.objects.get(email=email)                                                                                                                                                                                           
  File "/home/rapidpro/.virtualenvs/rapidpro/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method                                                                                                             
    return getattr(self.get_queryset(), name)(*args, **kwargs)                                                                                                                                                                                
  File "/home/rapidpro/.virtualenvs/rapidpro/lib/python3.6/site-packages/django/db/models/query.py", line 412, in get                                                                                                                         
    (self.model._meta.object_name, num)                                                                                                                                                                                                       
django.contrib.auth.models.User.MultipleObjectsReturned: get() returned more than one User -- it returned 2!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant