fix: 解决第三方登录一个不存在的本地用户时,改密日志会增加的问题

pull/13272/head
jiangweidong 2024-02-04 19:54:07 +08:00 committed by 老广
parent 132954ca81
commit 7e87f0bbf5
1 changed files with 4 additions and 2 deletions

View File

@ -34,6 +34,7 @@ class AuthMixin:
history_passwords: models.Manager history_passwords: models.Manager
need_update_password: bool need_update_password: bool
public_key: str public_key: str
username: str
is_local: bool is_local: bool
set_password: Callable set_password: Callable
save: Callable save: Callable
@ -54,6 +55,7 @@ class AuthMixin:
def set_password(self, raw_password): def set_password(self, raw_password):
if self.can_update_password(): if self.can_update_password():
if self.username:
self.date_password_last_updated = timezone.now() self.date_password_last_updated = timezone.now()
post_user_change_password.send(self.__class__, user=self) post_user_change_password.send(self.__class__, user=self)
super().set_password(raw_password) super().set_password(raw_password)