diff --git a/config/enhanced_auth_middleware.py b/config/enhanced_auth_middleware.py index 9129b42..c2da2bc 100644 --- a/config/enhanced_auth_middleware.py +++ b/config/enhanced_auth_middleware.py @@ -3,24 +3,11 @@ from django.contrib.auth import get_user_model from django.shortcuts import redirect from django.urls import reverse from django.contrib import messages +from config.middleware import get_admin_namespace User = get_user_model() -def get_admin_namespace(request): - """ - Determine the admin namespace based on the request domain. - Returns the appropriate admin namespace for use in reverse() calls. - """ - host = request.get_host() - - # Check if the request is from Dovoodi domain - if 'dovodi' in host or 'dovoodi' in host: - return 'dovoodi_admin' - else: - return 'imam_javad_admin' - - def enhanced_auth_middleware(get_response): """ Enhanced middleware for API authentication with admin restriction