Code

Ticket #18171: type_error_raised.diff

File type_error_raised.diff, 670 bytes (added by renatooliveira, 2 years ago)
Line 
1diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py
2index 0b3ccf7..8614b2a 100644
3--- a/django/contrib/auth/__init__.py
4+++ b/django/contrib/auth/__init__.py
5@@ -37,9 +37,8 @@ def authenticate(**credentials):
6     for backend in get_backends():
7         try:
8             user = backend.authenticate(**credentials)
9-        except TypeError:
10-            # This backend doesn't accept these credentials as arguments. Try the next one.
11-            continue
12+        except TypeError as e:
13+            raise TypeError(e.message)
14         if user is None:
15             continue
16         # Annotate the user object with the path of the backend.