From 11f0024c3301c880ccda5886aec783bb686be2af Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 31 Oct 2019 18:43:47 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=A4=8D=E6=A0=B8=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/tasks/const.py | 5 ++++- apps/jumpserver/conf.py | 3 ++- apps/jumpserver/context_processor.py | 1 + apps/templates/_nav.html | 2 +- apps/users/templates/users/user_detail.html | 5 +++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/assets/tasks/const.py b/apps/assets/tasks/const.py index 61a9580ed..6810a00bc 100644 --- a/apps/assets/tasks/const.py +++ b/apps/assets/tasks/const.py @@ -7,7 +7,10 @@ from django.utils.translation import ugettext_lazy as _ ENV_PERIOD_TASK = os.environ.get("PERIOD_TASK", "on") == 'on' -PERIOD_TASK_ENABLED = settings.PERIOD_TASK_ENABLED and ENV_PERIOD_TASK +ENV_PERIOD_TASK_ENABLED = os.environ.get("PERIOD_TASK_ENABLED", "on") == "on" +PERIOD_TASK_ENABLED = settings.CONFIG.PERIOD_TASK_ENABLE \ + and ENV_PERIOD_TASK \ + and ENV_PERIOD_TASK_ENABLED UPDATE_ASSETS_HARDWARE_TASKS = [ { diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 27231af4b..936158bd8 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -394,8 +394,9 @@ defaults = { 'WINDOWS_SSH_DEFAULT_SHELL': 'cmd', 'FLOWER_URL': "127.0.0.1:5555", 'DEFAULT_ORG_SHOW_ALL_USERS': True, - 'PERIOD_TASK_ENABLED': True, + 'PERIOD_TASK_ENABLE': True, 'FORCE_SCRIPT_NAME': '', + 'LOGIN_CONFIRM_ENABLE': False } diff --git a/apps/jumpserver/context_processor.py b/apps/jumpserver/context_processor.py index bb51c3a4f..e940f06f6 100644 --- a/apps/jumpserver/context_processor.py +++ b/apps/jumpserver/context_processor.py @@ -20,6 +20,7 @@ def jumpserver_processor(request): 'SECURITY_MFA_VERIFY_TTL': settings.SECURITY_MFA_VERIFY_TTL, 'FORCE_SCRIPT_NAME': settings.FORCE_SCRIPT_NAME, 'SECURITY_VIEW_AUTH_NEED_MFA': settings.CONFIG.SECURITY_VIEW_AUTH_NEED_MFA, + 'LOGIN_CONFIRM_ENABLE': settings.CONFIG.LOGIN_CONFIRM_ENABLE, } return context diff --git a/apps/templates/_nav.html b/apps/templates/_nav.html index 36a2cb9ed..d23f549ca 100644 --- a/apps/templates/_nav.html +++ b/apps/templates/_nav.html @@ -121,7 +121,7 @@ {% endif %} -{% if request.user.can_admin_current_org %} +{% if request.user.can_admin_current_org and LOGIN_CONFIRM_ENABLE %}
  • {% trans 'Orders' %} diff --git a/apps/users/templates/users/user_detail.html b/apps/users/templates/users/user_detail.html index b57480b18..eed7c8409 100644 --- a/apps/users/templates/users/user_detail.html +++ b/apps/users/templates/users/user_detail.html @@ -212,7 +212,6 @@ - {% if user_object.is_current_org_admin or user_object.is_superuser %}
    @@ -252,7 +251,7 @@
    - {% endif %} + {% if LOGIN_CONFIRM_ENABLE %}
    {% trans 'Login confirm' %} @@ -289,6 +288,8 @@
    + {% endif %} + {% endif %}