Code

Ticket #2550: auth-__init__-changed-viewable.diff

File auth-__init__-changed-viewable.diff, 917 bytes (added by umbrae@…, 8 years ago)

A (hopefully) viewable version of the previous diff

Line 
1Index: trunk/django/contrib/auth/__init__.py
2===================================================================
3--- trunk/django/contrib/auth/__init__.py       (revision 3596)
4+++ trunk/django/contrib/auth/__init__.py       (working copy)
5@@ -1,4 +1,4 @@
6-from django.core.exceptions import ImproperlyConfigured
7+from django.core.exceptions import ImproperlyConfigured, PermissionDenied
8
9 SESSION_KEY = '_auth_user_id'
10 BACKEND_SESSION_KEY = '_auth_user_backend'
11@@ -35,6 +35,9 @@
12         except TypeError:
13             # This backend doesn't accept these credentials as arguments. Try the next one.
14             continue
15+        except PermissionDenied:
16+            # This backend says to stop in our tracks - this user should not be allowed in at all.
17+            return None
18         if user is None:
19             continue
20         # Annotate the user object with the path of the backend.