mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -06:00
added additional logging when client ip cannot be determined
This commit is contained in:
parent
07c3b178c7
commit
6f634c74eb
@ -8,4 +8,11 @@ from utilities.request import get_client_ip
|
||||
def log_user_login_failed(sender, credentials, request, **kwargs):
|
||||
logger = logging.getLogger('netbox.auth.login')
|
||||
username = credentials.get("username")
|
||||
logger.info(f"Failed login attempt for username: {username} from {get_client_ip(request)}")
|
||||
if client_ip := get_client_ip(request):
|
||||
logger.info(f"Failed login attempt for username: {username} from {client_ip}")
|
||||
else:
|
||||
logger.warning(
|
||||
"Client IP address could not be determined for validation. Check that the HTTP server is properly "
|
||||
"configured to pass the required header(s)."
|
||||
)
|
||||
logger.info(f"Failed login attempt for username: {username}")
|
||||
|
Loading…
Reference in New Issue
Block a user