mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-22 08:19:04 +00:00
* [Update] user model 添加date_password_last_updated字段, 并在用户详情/个人信息页进行展示、重置密码/修改密码时进行更新;安全设置添加密码过期时间配置项; * [Update] 修改依赖,deb_requirements 删除 gcc automake * [Update] 添加定时任务: 检测用户密码是否过期 * [Update] 登录页面添加检测用户密码是否过期,并给出过期提示,拒绝登录 * [update] 用户密码过期时间5天以内,每天发送重置密码邮件 * [Update] api 登录认证,添加密码过期检测 * [Update] 添加提示用户密码即将过期信息 * [Update] 修改小细节 * [Update] User model 添加密码即将过期/已过期 property属性 * [Update] 修改用户api auth检测用户密码过期逻辑 * [Update] 添加翻译,用户密码过期 * [Update] 用户密码即将过期,发送密码过期提醒邮件 * [Update] 修改检测用户密码过期任务,修改interval为crontab * [Update] 修改翻译小细节 * [Update] 修改翻译小细节 * [Bugfix] 修复在用户更新页面修改密码时, 不更新最后密码修改时间的bug * [Update] 修复小细节 * [Update] 修改系统设置成功提示翻译信息
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
|
|
from celery import shared_task
|
|
|
|
from ops.celery.utils import (
|
|
create_or_update_celery_periodic_tasks,
|
|
after_app_ready_start
|
|
)
|
|
from .models import User
|
|
from common.utils import get_logger
|
|
from .utils import write_login_log, send_password_expiration_reminder_mail
|
|
|
|
|
|
logger = get_logger(__file__)
|
|
|
|
|
|
@shared_task
|
|
def write_login_log_async(*args, **kwargs):
|
|
write_login_log(*args, **kwargs)
|
|
|
|
|
|
@shared_task
|
|
def check_password_expired():
|
|
users = User.objects.exclude(role=User.ROLE_APP)
|
|
for user in users:
|
|
if not user.password_will_expired:
|
|
continue
|
|
|
|
send_password_expiration_reminder_mail(user)
|
|
logger.info("The user {} password expires in {} days".format(
|
|
user, user.password_expired_remain_days)
|
|
)
|
|
|
|
|
|
@shared_task
|
|
@after_app_ready_start
|
|
def check_password_expired_periodic():
|
|
tasks = {
|
|
'check_password_expired_periodic': {
|
|
'task': check_password_expired.name,
|
|
'interval': None,
|
|
'crontab': '0 10 * * *',
|
|
'enabled': True,
|
|
}
|
|
}
|
|
create_or_update_celery_periodic_tasks(tasks)
|