Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

500 when using the Doppelgänger function in the Django Admin #1388

Open
malemburg opened this issue May 7, 2021 · 2 comments
Open

500 when using the Doppelgänger function in the Django Admin #1388

malemburg opened this issue May 7, 2021 · 2 comments
Labels
2022 bug goodfirstissue If you've never contributed to epcon before – this should be easiest to start with

Comments

@malemburg
Copy link
Member

In some cases, we're getting a 500 when using the Doppelgänger function on user accounts. Apparently, this happens whenever a user has not been activated yet.

Here's an example traceback:

Traceback:

File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/__init__.py" in login
  111.         backend = backend or user.backend

During handling of the above exception ('AnonymousUser' object has no attribute 'backend'), another exception occurred:

File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)

File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.8/site-packages/django/utils/decorators.py" in _wrapped_view
  142.                     response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.8/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.8/site-packages/django/contrib/admin/sites.py" in inner
  223.             return view(request, *args, **kwargs)

File "/usr/src/ep2021/assopy/admin.py" in create_doppelganger
  436.         auth.login(request, user)

File "/usr/local/lib/python3.8/site-packages/django/contrib/auth/__init__.py" in login
  117.             raise ValueError(

Exception Type: ValueError at /admin/auth/user/xxxx/login/
Exception Value: You have multiple authentication backends configured and therefore must provide the `backend` argument or set the `backend` attribute on the user.

SO suggests adding a backend parameter: https://stackoverflow.com/questions/45961459/multiple-authentication-backends-configured-and-therefore-must-provide-the-back, however, it's possible that we simply need to just return an error saying that the user has not been activated yet, so the Doppelgänger function doesn't work.

@malemburg malemburg added bug 2021 goodfirstissue If you've never contributed to epcon before – this should be easiest to start with labels May 7, 2021
@fpierfed fpierfed added 2022 and removed 2021 labels Jul 31, 2021
@AnudeepGunukula
Copy link

Hi i am interested in this project.
i would like to work on this issue
kindly let me know if this is still open

@fpierfed
Copy link
Contributor

Hi there! Thank you for the offer, we do appreciate it. The issue is still open so if you had interested in working on it, please go ahead :-)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2022 bug goodfirstissue If you've never contributed to epcon before – this should be easiest to start with
Projects
None yet
Development

No branches or pull requests

3 participants