diff --git a/apps/users/models/user.py b/apps/users/models/user.py index aca0c14a8..5f3739400 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -41,6 +41,7 @@ class AuthMixin: history_passwords: models.Manager need_update_password: bool public_key: str + username: str is_local: bool set_password: Callable save: Callable @@ -63,9 +64,10 @@ class AuthMixin: def set_password(self, raw_password): if self.can_update_password(): - self.date_password_last_updated = timezone.now() - post_user_change_password.send(self.__class__, user=self) - super().set_password(raw_password) + if self.username: + self.date_password_last_updated = timezone.now() + post_user_change_password.send(self.__class__, user=self) + super().set_password(raw_password) # noqa def set_public_key(self, public_key): if self.can_update_ssh_key():