sources/ldap: fix sync for Users without pwdLastSet

This commit is contained in:
Jens Langhammer 2021-03-03 22:54:05 +01:00
parent ff5f5f65e8
commit 32655567da
1 changed files with 2 additions and 4 deletions

View File

@ -60,10 +60,8 @@ class UserLDAPSynchronizer(BaseLDAPSynchronizer):
"Synced User", user=ak_user.username, created=created
)
user_count += 1
# pylint: disable=no-value-for-parameter
pwd_last_set = UTC.localize(
attributes.get("pwdLastSet", datetime.now())
)
pwd_last_set: datetime = attributes.get("pwdLastSet", datetime.now())
pwd_last_set = pwd_last_set.replace(tzinfo=UTC)
if created or pwd_last_set >= ak_user.password_change_date:
self._logger.debug(
"Reset user's password",