Ticket #16262: auth-models.patch

File auth-models.patch, 741 bytes (added by Mitar, 13 years ago)
  • contrib/auth/models.py

    diff -Naur django.orig/contrib/auth/models.py django/contrib/auth/models.py
    old new  
    3939    Returns a boolean of whether the raw_password was correct. Handles
    4040    encryption formats behind the scenes.
    4141    """
    42     algo, salt, hsh = enc_password.split('$')
    43     return constant_time_compare(hsh, get_hexdigest(algo, salt, raw_password))
     42    try:
     43        algo, salt, hsh = enc_password.split('$')
     44        return constant_time_compare(hsh, get_hexdigest(algo, salt, raw_password))
     45    except ValueError:
     46        return False
    4447
    4548def update_last_login(sender, user, **kwargs):
    4649    """
Back to Top