diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 757af26fe..0deef705e 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -347,6 +347,7 @@ defaults = { 'RADIUS_SECRET': '', 'HTTP_BIND_HOST': '0.0.0.0', 'HTTP_LISTEN_PORT': 8080, + 'LOGIN_LOG_KEEP_DAYS': 90, } diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 22e660bb1..60aa609f0 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -527,6 +527,7 @@ TERMINAL_ASSET_LIST_PAGE_SIZE = CONFIG.TERMINAL_ASSET_LIST_PAGE_SIZE TERMINAL_SESSION_KEEP_DURATION = CONFIG.TERMINAL_SESSION_KEEP_DURATION TERMINAL_HOST_KEY = CONFIG.TERMINAL_HOST_KEY TERMINAL_HEADER_TITLE = CONFIG.TERMINAL_HEADER_TITLE +TERMINAL_TELNET_REGEX = CONFIG.TERMINAL_TELNET_REGEX # Django bootstrap3 setting, more see http://django-bootstrap3.readthedocs.io/en/latest/settings.html BOOTSTRAP3 = { @@ -556,4 +557,4 @@ SWAGGER_SETTINGS = { # Default email suffix EMAIL_SUFFIX = CONFIG.EMAIL_SUFFIX -TERMINAL_TELNET_REGEX = CONFIG.TERMINAL_TELNET_REGEX +LOGIN_LOG_KEEP_DAYS = CONFIG.LOGIN_LOG_KEEP_DAYS diff --git a/apps/ops/templates/ops/task_list.html b/apps/ops/templates/ops/task_list.html index 1b18f206c..0426e059d 100644 --- a/apps/ops/templates/ops/task_list.html +++ b/apps/ops/templates/ops/task_list.html @@ -9,14 +9,6 @@ {% block table_search %}
-
-
- - - to - -
-
diff --git a/apps/ops/views/adhoc.py b/apps/ops/views/adhoc.py index abebfdbde..70b9b3f45 100644 --- a/apps/ops/views/adhoc.py +++ b/apps/ops/views/adhoc.py @@ -33,11 +33,6 @@ class TaskListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView): queryset = queryset.filter(created_by='') self.keyword = self.request.GET.get('keyword', '') - queryset = queryset.filter( - date_created__gt=self.date_from, - date_created__lt=self.date_to - ) - if self.keyword: queryset = queryset.filter( name__icontains=self.keyword, diff --git a/apps/users/tasks.py b/apps/users/tasks.py index 769d01ed7..a77595a4b 100644 --- a/apps/users/tasks.py +++ b/apps/users/tasks.py @@ -1,12 +1,15 @@ # -*- coding: utf-8 -*- # +import datetime +from django.utils import timezone +from django.conf import settings from celery import shared_task from ops.celery.utils import create_or_update_celery_periodic_tasks -from ops.celery.decorator import after_app_ready_start -from .models import User +from ops.celery.decorator import after_app_ready_start, register_as_period_task from common.utils import get_logger +from .models import User, LoginLog from .utils import write_login_log, send_password_expiration_reminder_mail @@ -43,3 +46,15 @@ def check_password_expired_periodic(): } } create_or_update_celery_periodic_tasks(tasks) + + +@register_as_period_task(interval=3600*24) +@shared_task +def clean_login_log_period(): + now = timezone.now() + try: + days = int(settings.LOGIN_LOG_KEEP_DAYS) + except ValueError: + days = 90 + expired_day = now - datetime.timedelta(days=days) + LoginLog.objects.filter(datetime__lt=expired_day).delete() diff --git a/apps/users/views/login.py b/apps/users/views/login.py index 3b960b7a5..5931e578a 100644 --- a/apps/users/views/login.py +++ b/apps/users/views/login.py @@ -291,7 +291,7 @@ class UserResetPasswordView(TemplateView): template_name = 'users/reset_password.html' def get(self, request, *args, **kwargs): - token = request.GET.get('token') + token = request.GET.get('token', '') user = User.validate_reset_token(token) if not user: kwargs.update({'errors': _('Token invalid or expired')}) diff --git a/config_example.yml b/config_example.yml index da09c9e80..bf5cdacb3 100644 --- a/config_example.yml +++ b/config_example.yml @@ -61,6 +61,14 @@ REDIS_PORT: 6379 # AUTH_OPENID_REALM_NAME: realm-name # AUTH_OPENID_CLIENT_ID: client-id # AUTH_OPENID_CLIENT_SECRET: client-secret +# +# Use Radius authorization +# 使用Radius来认证 +# AUTH_RADIUS: false +# RADIUS_SERVER: localhost +# RADIUS_PORT: 1812 +# RADIUS_SECRET: + # OTP settings # OTP/MFA 配置 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 000000000..e4d922911 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,5 @@ +## 说明 +文档已移动到docs分支,该目录中不是最新文档, 请提交到docs分支 + +## 访问在线文档 +[访问](https://docs.jumpserver.org)