Skip to content

Commit

Permalink
fix: 解决第三方登录一个不存在的本地用户时,改密日志会增加的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
O-Jiangweidong authored and BaiJiangJie committed Dec 14, 2023
1 parent 3c9239e commit 438e9de
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/users/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -63,9 +64,10 @@ def password_raw(self, password_raw_):

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():
Expand Down

0 comments on commit 438e9de

Please sign in to comment.