mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
10653 log failed login attempts on INFO (#10843)
* 10653 log failed login attempts on INFO * 10653 use signal to log failed login attempts * 10653 use signal to log failed login attempts * Update netbox/users/signals.py Co-authored-by: Jeremy Stretch <jstretch@ns1.com> * Update netbox/users/apps.py Co-authored-by: Jeremy Stretch <jstretch@ns1.com> Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
This commit is contained in:
10
netbox/users/signals.py
Normal file
10
netbox/users/signals.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import logging
|
||||
from django.dispatch import receiver
|
||||
from django.contrib.auth.signals import user_login_failed
|
||||
|
||||
|
||||
@receiver(user_login_failed)
|
||||
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}")
|
Reference in New Issue
Block a user