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

AXES_LOCKOUT_PARAMETERS = ["username"] with email as username doesn't work #1133

Open
Zerotask opened this issue Nov 6, 2023 · 2 comments
Open

Comments

@Zerotask
Copy link

Zerotask commented Nov 6, 2023

Describe the bug
We have a custom user model which uses an email field as username

USERNAME_FIELD = "email"

If I set

AXES_LOCKOUT_PARAMETERS = ["username"]
AXES_CLIENT_IP_CALLABLE = lambda x: None  # noqa: E731

and try to login, I get the console output:

AXES: Username is None and username is the only one lockout parameter, new record will NOT be created.

Expected behavior
email is used as the username

Your environment
python version: 3.12
django version: 4.2.7
django-axes version: 6.1.1
Operating system: MacOS 14.1

Additional context

Before I tried it with ipware which works perfectly.

@Zerotask Zerotask added the bug label Nov 6, 2023
@Zerotask
Copy link
Author

Zerotask commented Nov 6, 2023

Update: it does work, if I set AXES_USERNAME_FORM_FIELD = "email"
Is it possible to check for USERNAME_FIELD so that you don't have to additionally set this?

@aleksihakli
Copy link
Member

Sure, would you like to open a PR for implementing this improvement?

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

2 participants