Commit 637fc914 authored by BaiJiangJie's avatar BaiJiangJie

[Update] 密码过期邮件发送(密码未过期用户&有效用户)

parent b5aa69db
...@@ -111,7 +111,7 @@ class AuthMixin: ...@@ -111,7 +111,7 @@ class AuthMixin:
@property @property
def password_will_expired(self): def password_will_expired(self):
if self.is_local and self.password_expired_remain_days < 5: if self.is_local and 0 <= self.password_expired_remain_days < 5:
return True return True
return False return False
......
...@@ -20,13 +20,13 @@ logger = get_logger(__file__) ...@@ -20,13 +20,13 @@ logger = get_logger(__file__)
def check_password_expired(): def check_password_expired():
users = User.objects.exclude(role=User.ROLE_APP) users = User.objects.exclude(role=User.ROLE_APP)
for user in users: for user in users:
if not user.is_valid:
continue
if not user.password_will_expired: if not user.password_will_expired:
continue continue
send_password_expiration_reminder_mail(user) send_password_expiration_reminder_mail(user)
logger.info("The user {} password expires in {} days".format( msg = "The user {} password expires in {} days"
user, user.password_expired_remain_days) logger.info(msg.format(user, user.password_expired_remain_days))
)
@shared_task @shared_task
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment