﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18998	Removing an authentication backend that's cached in a user's session causes exception	Bradley Ayers <brad@…>	jorgebastida	"Here's the scenario:

1. I add a new authentication backend to `AUTHENTICATION_BACKENDS`.
2. I deploy the code and a user logs in using that backend, and then logs out.
3. I decide I want to change the name of the backend, so I do, and update `AUTHENTICATION_BACKENDS` accordingly.
4. I deploy the code, and the same user loads the login page again.

On loading the page, an exception will be raised:

{{{
Traceback (most recent call last):

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/core/handlers/base.py"", line 111, in get_response
 response = callback(request, *callback_args, **callback_kwargs)

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/console/base.py"", line 105, in wrapped
 result = func(request, *args, **kwargs)

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/contrib/auth/decorators.py"", line 19, in _wrapped_view
 if test_func(request.user):

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/utils/functional.py"", line 184, in inner
 self._setup()

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/utils/functional.py"", line 248, in _setup
 self._wrapped = self._setupfunc()

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/contrib/auth/middleware.py"", line 16, in <lambda>
 request.user = SimpleLazyObject(lambda: get_user(request))

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/contrib/auth/middleware.py"", line 8, in get_user
 request._cached_user = auth.get_user(request)

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/contrib/auth/__init__.py"", line 100, in get_user
 backend = load_backend(backend_path)

 File ""/var/www/httpdocs/.env/lib/python2.7/site-packages/django/contrib/auth/__init__.py"", line 22, in load_backend
 raise ImproperlyConfigured('Module ""%s"" does not define a ""%s"" authentication backend' % (module, attr))

ImproperlyConfigured: Module ""project.apps.core.backends"" does not define a ""EmailOrUsernameModelBackend"" authentication backend
}}}

`EmailOrUsernameModelBackend` is the name of the old backend that has been renamed."	Bug	closed	contrib.auth	1.4	Normal	fixed		sunny@…	Ready for checkin	1	0	0	0	1	0
