Skip to content

Commit

Permalink
Fixed UNUSABLE_PASSWORD import
Browse files Browse the repository at this point in the history
It was apparently an internal api, subject to change.
  • Loading branch information
reinout committed Sep 22, 2016
1 parent b22b26d commit 0d26725
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lizard_auth_client/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@

import logging

from django.core.cache import cache
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.hashers import is_password_usable
from django.contrib.auth.hashers import check_password, make_password

try:
from django.contrib.auth.hashers import UNUSABLE_PASSWORD
except:
# ImproperlyConfigured:
# Don't know what is wrong
UNUSABLE_PASSWORD = 'bla'
from django.core.cache import cache

from lizard_auth_client.conf import settings
from lizard_auth_client import client
Expand Down Expand Up @@ -65,7 +59,7 @@ def authenticate(self, username=None, password=None):

# Store user_data in cache.
hashed_password = make_password(password)
if hashed_password is UNUSABLE_PASSWORD:
if not is_password_usable(hashed_password):
return None
else:
cache.set(
Expand Down

0 comments on commit 0d26725

Please sign in to comment.