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

pull/12337/head
jiangweidong 12 months ago committed by Bryan
parent 3c9239eb09
commit 438e9dee2a

@ -41,6 +41,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
@ -63,9 +64,10 @@ class AuthMixin:
def set_password(self, raw_password): def set_password(self, raw_password):
if self.can_update_password(): if self.can_update_password():
self.date_password_last_updated = timezone.now() if self.username:
post_user_change_password.send(self.__class__, user=self) self.date_password_last_updated = timezone.now()
super().set_password(raw_password) post_user_change_password.send(self.__class__, user=self)
super().set_password(raw_password) # noqa
def set_public_key(self, public_key): def set_public_key(self, public_key):
if self.can_update_ssh_key(): if self.can_update_ssh_key():

Loading…
Cancel
Save