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 %}