-
-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Labels
Description
We are using Django 3.2.18 and AXES 5.30.0 on Python 3.6. We are not utilizing DRF for our implementation.
When we attempt to catch the "user_locked_out" signal sent by axes, the username being returned is always set to None.
@receiver(user_locked_out)
def log_user_lockout(request, username, ip_address, **kwargs):
"""Log user lockout using axes signal."""
user = username # This will always result in None
function_signal.send("audit_log", message=f"{user} account has been locked.")`
Is there a method or way to trigger a locked out user account without using the DRF? My current workaround is to trigger on the user_login_failed signal and inspect the kwargs.get("request").axes_locked_out value. I still need to have the user_locked_out code in order to properly trigger the signal.
End goal of the code is we want to log when a user is locked out to an audit log file with the username of the account that was locked out.