Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user_locked_out signal always returns username of None #1043

Open
Neumsy opened this issue Apr 26, 2023 · 2 comments
Open

user_locked_out signal always returns username of None #1043

Neumsy opened this issue Apr 26, 2023 · 2 comments

Comments

@Neumsy
Copy link

Neumsy commented Apr 26, 2023

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.

@stereodamage
Copy link

Hello! Can you please tell if AXES_USERNAME_CALLABLE is configured and if not, which way one is authenticating (e.g. via username/password on the form)

@Neumsy
Copy link
Author

Neumsy commented Jun 26, 2023

We do not have AXES_USERNAME_CALLABLE configured. We are authenticating our users via username and password.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants