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