Password reset raises error if multiple accounts with the same mail address exist
Log from the error:
Internal Server Error: /accounts/password_reset/
Traceback (most recent call last):
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/contrib/auth/views.py", line 222, in dispatch
return super().dispatch(*args, **kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/srv/libravatar/ivatar/ivataraccount/views.py", line 1084, in post
user = User.objects.get(email=request.POST["email"])
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/data/venvs/libravatar/lib/python3.10/site-packages/django/db/models/query.py", line 439, in get
raise self.model.MultipleObjectsReturned(
django.contrib.auth.models.User.MultipleObjectsReturned: get() returned more than one User -- it returned 4!
Edited by Oliver Falk