# HG changeset patch # User Gustavo Andres Morero # Date 1597181705 10800 # Tue Aug 11 18:35:05 2020 -0300 # Node ID ef1f7085afbac7cf1a084fe68260332f42e183a2 # Parent f8f3c1bc0e57c80fb29e2941ef39a395bad717e0 show NLOTP_SETUP_EXCLUDED_URLS setting required error only if NLOTP_2FA_SETUP_REQUIRED is enabled. diff --git a/nlotp/checks.py b/nlotp/checks.py --- a/nlotp/checks.py +++ b/nlotp/checks.py @@ -2,6 +2,8 @@ from django.conf import settings from django.core.checks import Error, Warning +from .settings import NLOTP_2FA_SETUP_REQUIRED + REQUIRED_INSTALLED_APPS = ( { "key": "django_otp", @@ -32,6 +34,7 @@ "A list of urls excluded from redirect to verify page " "if user is not OTP verified." ), + "show": True, }, { "key": "NLOTP_SETUP_EXCLUDED_URLS", @@ -41,6 +44,7 @@ "if user didn't setup 2FA and it's required " "(NLOTP_2FA_SETUP_REQUIRED = True)." ), + "show": NLOTP_2FA_SETUP_REQUIRED, }, ) @@ -91,7 +95,7 @@ def check_required_settings(app_configs, **kwargs): errors = [] for setting in REQUIRED_SETTINGS: - if getattr(settings, setting["key"], None) is None: + if setting["show"] and getattr(settings, setting["key"], None) is None: errors.append( Error( f"needs 'settings.{setting['key']}' defined.",