Merge branch 'stable' into dev

pull/2461/head
ibuler 2019-03-04 10:47:31 +08:00
commit e76392a169
8 changed files with 34 additions and 17 deletions

View File

@ -347,6 +347,7 @@ defaults = {
'RADIUS_SECRET': '', 'RADIUS_SECRET': '',
'HTTP_BIND_HOST': '0.0.0.0', 'HTTP_BIND_HOST': '0.0.0.0',
'HTTP_LISTEN_PORT': 8080, 'HTTP_LISTEN_PORT': 8080,
'LOGIN_LOG_KEEP_DAYS': 90,
} }

View File

@ -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_SESSION_KEEP_DURATION = CONFIG.TERMINAL_SESSION_KEEP_DURATION
TERMINAL_HOST_KEY = CONFIG.TERMINAL_HOST_KEY TERMINAL_HOST_KEY = CONFIG.TERMINAL_HOST_KEY
TERMINAL_HEADER_TITLE = CONFIG.TERMINAL_HEADER_TITLE 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 # Django bootstrap3 setting, more see http://django-bootstrap3.readthedocs.io/en/latest/settings.html
BOOTSTRAP3 = { BOOTSTRAP3 = {
@ -556,4 +557,4 @@ SWAGGER_SETTINGS = {
# Default email suffix # Default email suffix
EMAIL_SUFFIX = CONFIG.EMAIL_SUFFIX EMAIL_SUFFIX = CONFIG.EMAIL_SUFFIX
TERMINAL_TELNET_REGEX = CONFIG.TERMINAL_TELNET_REGEX LOGIN_LOG_KEEP_DAYS = CONFIG.LOGIN_LOG_KEEP_DAYS

View File

@ -9,14 +9,6 @@
{% block table_search %} {% block table_search %}
<form id="search_form" method="get" action="" class="pull-right form-inline"> <form id="search_form" method="get" action="" class="pull-right form-inline">
<div class="form-group" id="date">
<div class="input-daterange input-group" id="datepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from|date:'Y-m-d' }}">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to|date:'Y-m-d' }}">
</div>
</div>
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control input-sm" name="keyword" placeholder="{% trans 'Search' %}" value="{{ keyword }}"> <input type="text" class="form-control input-sm" name="keyword" placeholder="{% trans 'Search' %}" value="{{ keyword }}">
</div> </div>

View File

@ -33,11 +33,6 @@ class TaskListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView):
queryset = queryset.filter(created_by='') queryset = queryset.filter(created_by='')
self.keyword = self.request.GET.get('keyword', '') 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: if self.keyword:
queryset = queryset.filter( queryset = queryset.filter(
name__icontains=self.keyword, name__icontains=self.keyword,

View File

@ -1,12 +1,15 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
import datetime
from django.utils import timezone
from django.conf import settings
from celery import shared_task from celery import shared_task
from ops.celery.utils import create_or_update_celery_periodic_tasks from ops.celery.utils import create_or_update_celery_periodic_tasks
from ops.celery.decorator import after_app_ready_start from ops.celery.decorator import after_app_ready_start, register_as_period_task
from .models import User
from common.utils import get_logger from common.utils import get_logger
from .models import User, LoginLog
from .utils import write_login_log, send_password_expiration_reminder_mail 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) 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()

View File

@ -291,7 +291,7 @@ class UserResetPasswordView(TemplateView):
template_name = 'users/reset_password.html' template_name = 'users/reset_password.html'
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
token = request.GET.get('token') token = request.GET.get('token', '')
user = User.validate_reset_token(token) user = User.validate_reset_token(token)
if not user: if not user:
kwargs.update({'errors': _('Token invalid or expired')}) kwargs.update({'errors': _('Token invalid or expired')})

View File

@ -61,6 +61,14 @@ REDIS_PORT: 6379
# AUTH_OPENID_REALM_NAME: realm-name # AUTH_OPENID_REALM_NAME: realm-name
# AUTH_OPENID_CLIENT_ID: client-id # AUTH_OPENID_CLIENT_ID: client-id
# AUTH_OPENID_CLIENT_SECRET: client-secret # AUTH_OPENID_CLIENT_SECRET: client-secret
#
# Use Radius authorization
# 使用Radius来认证
# AUTH_RADIUS: false
# RADIUS_SERVER: localhost
# RADIUS_PORT: 1812
# RADIUS_SECRET:
# OTP settings # OTP settings
# OTP/MFA 配置 # OTP/MFA 配置

5
docs/README.md Normal file
View File

@ -0,0 +1,5 @@
## 说明
文档已移动到docs分支该目录中不是最新文档, 请提交到docs分支
## 访问在线文档
[访问](https://docs.jumpserver.org)