mirror of
https://github.com/ansible/awx.git
synced 2026-01-20 22:18:01 -03:30
15 lines
477 B
Python
15 lines
477 B
Python
import logging
|
|
|
|
from django.conf import settings
|
|
from django.contrib.auth.backends import ModelBackend
|
|
|
|
logger = logging.getLogger('awx.main.backends')
|
|
|
|
|
|
class AWXModelBackend(ModelBackend):
|
|
def authenticate(self, request, **kwargs):
|
|
if settings.DISABLE_LOCAL_AUTH:
|
|
logger.warning(f"User '{kwargs['username']}' attempted login through the disabled local authentication system.")
|
|
return
|
|
return super().authenticate(request, **kwargs)
|