From 438e9dee2a296ddfd4be9dd4f125e0647df9f8ac Mon Sep 17 00:00:00 2001 From: jiangweidong Date: Thu, 14 Dec 2023 17:34:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E7=99=BB=E5=BD=95=E4=B8=80=E4=B8=AA=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E6=9C=AC=E5=9C=B0=E7=94=A8=E6=88=B7=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E5=AF=86=E6=97=A5=E5=BF=97=E4=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/models/user.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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():