show NLOTP_SETUP_EXCLUDED_URLS setting required error only if NLOTP_2FA_SETUP_REQUIRED is enabled.
1 files changed, 5 insertions(+), 1 deletions(-)

M nlotp/checks.py
M nlotp/checks.py +5 -1
@@ 2,6 2,8 @@ from django.apps import apps
 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 @@ REQUIRED_SETTINGS = (
             "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 @@ REQUIRED_SETTINGS = (
             "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_installed_apps(app_co
 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.",