sources/ldap(minor): call set_unusable_password when creating new user

This commit is contained in:
Langhammer, Jens 2019-10-12 13:59:52 +02:00
parent 34ed0b3594
commit d7483d129f
1 changed files with 4 additions and 1 deletions

View File

@ -82,10 +82,13 @@ class Connector:
attributes=ldap3.ALL_ATTRIBUTES)
for user in users:
attributes = user.get('attributes', {})
_, created = User.objects.update_or_create(
user, created = User.objects.update_or_create(
attributes__ldap_uniq=attributes.get(self._source.object_uniqueness_field, ''),
defaults=self._build_object_properties(attributes),
)
if created:
user.set_unusable_password()
user.save()
LOGGER.debug("Synced User", user=attributes.get('name', ''), created=created)
def sync_membership(self):