Change ldap credentials which was set to dummy during migration

This commit is contained in:
PCoder 2020-03-05 22:40:59 +05:30
parent b9096de386
commit d21c5837f7

View file

@ -235,6 +235,15 @@ class CustomUser(AbstractBaseUser, PermissionsMixin):
email=self.email)
self.in_ldap = True
self.save()
else:
# User exists already in LDAP, but with a dummy credential
# We are here implies that the user has successfully
# authenticated against Django db, and a corresponding user
# exists in LDAP.
# We just update the LDAP credentials once again, assuming it
# was set to a dummy value while migrating users from Django to
# LDAP
ldap_manager.change_password(self.username, password)
def __str__(self): # __unicode__ on Python 2
return self.email