From 32655567daa3eb61a8cab27312aa9c762eb8998a Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 3 Mar 2021 22:54:05 +0100 Subject: [PATCH] sources/ldap: fix sync for Users without pwdLastSet --- authentik/sources/ldap/sync/users.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/authentik/sources/ldap/sync/users.py b/authentik/sources/ldap/sync/users.py index 703da2f31..5100189b5 100644 --- a/authentik/sources/ldap/sync/users.py +++ b/authentik/sources/ldap/sync/users.py @@ -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",