implement LDAP password hashing

- add passlib to requirements/base.txt
- implement ldapentities.models.LdapUser.set_password
This commit is contained in:
Jan Dittberner 2014-05-30 01:13:41 +02:00
parent 3babbc5b3f
commit 72f5d78c10
2 changed files with 6 additions and 0 deletions

View file

@ -7,6 +7,8 @@ from ldapdb.models.fields import (
)
import ldapdb.models as ldapmodels
from passlib.hash import ldap_salted_sha1
@python_2_unicode_compatible
class LdapGroup(ldapmodels.Model):
@ -48,3 +50,6 @@ class LdapUser(ldapmodels.Model):
def __str__(self):
return self.username
def set_password(self, password):
self.password = ldap_salted_sha1.encrypt(password)

View file

@ -6,3 +6,4 @@ django-model-utils==2.0.3
logutils==0.3.3
South==0.8.4
celery==3.1.11
passlib==1.6.2