Ticket #6490: 0018-Accept-variable-keyword-args-in-authentication.patch

File 0018-Accept-variable-keyword-args-in-authentication.patch, 1.1 KB (added by Bastian Kleineidam <calvin@…>, 10 years ago)
  • django/contrib/auth/backends.py

    From fe4ca7eeba969e6f31d0c086f078fc1a8b72fa8f Mon Sep 17 00:00:00 2001
    From: Bastian Kleineidam <calvin@debian.org>
    Date: Fri, 25 Jan 2008 21:17:53 +0100
    Subject: Accept variable keyword args in authentication
    Currently authentication functions accept username and password,
    but some authentication algorithms may require other types
    of credentials (such as public keys or ip addresses).
    Thus the authenticate() function should accept variable keyword
    arguments to allow such constructs.
    Signed-off-by: Bastian Kleineidam <calvin@debian.org>
    diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
    index f79929e..de9b417 100644
    a b class ModelBackend: 
    1212    """
    1313    # TODO: Model, login attribute name and password attribute name should be
    1414    # configurable.
    15     def authenticate(self, username=None, password=None):
     15    def authenticate(self, username=None, password=None, **kwargs):
    1616        try:
    1717            user = User.objects.get(username=username)
    1818            if user.check_password(password):
Back to Top