-
Notifications
You must be signed in to change notification settings - Fork 459
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
Is it possible to login by email, not username ? #389
Comments
It is but it's not directly related with Djoser. Please, see also: https://docs.djangoproject.com/en/2.2/topics/auth/customizing/#substituting-a-custom-user-model |
I see... I already have django running in production, and this is not as easy to do according to: I found that this project offers login by email (if you use ACCOUNT_USERNAME_REQUIRED=False): Maybe, it would be nice if Djoser will also have this possibility... |
Yeah, it's not recommended when you already have a system running in production.
If you do not intend to replace the username field with email in your models and just want to be able to login using the email address, it is relatively easy to write a custom view to achieve this. |
I see. |
Well, regarding the original question you mentioned only the endpoint |
I see, ok, thank you, it is very good explanation ! |
You are welcome.
To be honest, I did a search on their repository and didn't find any reference to the variable |
This variable is taken from django-allauth which you can install following Registration (optional) paragraph from: |
The setting In the login endpoint, it probably only substitutes the lookup field when logging in. Internally you still have the username and email fields and username is still the default in the |
Yeah, maybe this is what it does in login endpoint. |
Thank you, @nbap for handling this issue 👍 Djoser has relied on |
Can't figure out a way to pass the
But it seems the user model has not been loaded at this point, how can I pass in this parameter |
same issue @superibk |
Try this:
|
@TulsiSwami is Right. |
@Chiz0m Djoser uses the username by default for /users/ so you don't necessarily have to include that in the configuration. |
The issue is not in djoser, the default django/contrib/auth/models that djoser serializer depends on.
Here is default User manager:
Done |
I would like to use /token/login/ endpoint, but it accepts only username.
Is it possible to login by email instead ?
The text was updated successfully, but these errors were encountered: