diff --git a/apps/authentication/backends/custom.py b/apps/authentication/backends/custom.py index 4432e2919..3a0bafeb0 100644 --- a/apps/authentication/backends/custom.py +++ b/apps/authentication/backends/custom.py @@ -1,6 +1,4 @@ -import os from django.conf import settings -import inspect from django.utils.module_loading import import_string from common.utils import get_logger from django.contrib.auth import get_user_model @@ -15,6 +13,9 @@ logger = get_logger(__file__) class CustomAuthBackend(JMSModelBackend): custom_auth_method_path = 'data.auth.main.authenticate' + def load_authenticate_method(self): + return import_string(self.custom_auth_method_path) + def is_enabled(self): try: self.load_authenticate_method() @@ -35,9 +36,6 @@ class CustomAuthBackend(JMSModelBackend): ) return user, created - def load_authenticate_method(self): - return import_string(self.custom_auth_method_path) - def authenticate(self, request, username=None, password=None, **kwargs): try: authenticate = self.load_authenticate_method()