implement LDAP password hashing
- add passlib to requirements/base.txt - implement ldapentities.models.LdapUser.set_password
This commit is contained in:
parent
3babbc5b3f
commit
72f5d78c10
2 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,8 @@ from ldapdb.models.fields import (
|
||||||
)
|
)
|
||||||
import ldapdb.models as ldapmodels
|
import ldapdb.models as ldapmodels
|
||||||
|
|
||||||
|
from passlib.hash import ldap_salted_sha1
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class LdapGroup(ldapmodels.Model):
|
class LdapGroup(ldapmodels.Model):
|
||||||
|
@ -48,3 +50,6 @@ class LdapUser(ldapmodels.Model):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.username
|
return self.username
|
||||||
|
|
||||||
|
def set_password(self, password):
|
||||||
|
self.password = ldap_salted_sha1.encrypt(password)
|
||||||
|
|
|
@ -6,3 +6,4 @@ django-model-utils==2.0.3
|
||||||
logutils==0.3.3
|
logutils==0.3.3
|
||||||
South==0.8.4
|
South==0.8.4
|
||||||
celery==3.1.11
|
celery==3.1.11
|
||||||
|
passlib==1.6.2
|
||||||
|
|
Loading…
Reference in a new issue