Enhance error message for not activated user
See original GitHub issueHi. Thanks for the djoser. I like it as it makes life easier unlike other packages.
There is one thing I have come across. I’d suggest to change a feedback message for a non-active user who tries to obtain jwt, because now it returns the following:
{
"non_field_errors": [
"Unable to log in with provided credentials."
]
}
How can I detect if user tried wrong credentials or user has not just activated his account yet?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to Write Helpful Error Messages to Improve Your App's ...
Having useful error messages can go a long way toward making a frustrating scenario for an end-user as pleasant as possible.
Read more >Activate Windows Error Message after latest Windows 10 ...
Use your Windows 7 product key to reactivate. Click Start > Settings > Update & security > Activation > Change the product key...
Read more >How to Write Good Error Messages - UX Planet
Be concise and write a short description that is meaningful for user and gives him a clear idea of the problem and how...
Read more >We can't activate Windows on this device as we ... - YouTube
If you receive error message We can't activate Windows on this device as we can't connect to your organization's server, then:1] Ensure that ......
Read more >custom error message instead of FATAL ERROR in ...
The above express is to check whether Woocommerce is active and if it returns false, I do not want the plugin to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
app/serializers.py :
settings.py :
Hi @igsm! Thanks for your feedback!
I understand that receiving a token just after activation (or just after registration in some cases) is very handy for API clients (frontend web apps or mobile apps). However there are two reasons we do not do that:
As you noticed we need to support a few API auth methods so it is very difficult do it in a very generic way. Especially there are DRF auth backends that are not based on any type of token, like basic auth or session. Also JWT differs from DRF
auth_token
method.We believe that one endpoint should do one thing correctly and in a secure way. That’s why we love to think about endpoints as they are orthogonal actions.
Now, knowing the above if you really need authenticating users in your flow after activation then we suggest to override
ActivationView
and generate JWT token to response on successful activation in a manual way.@piotr-szpetkowski On the other hand I believe we can do the above customization easier in the future by utilizing custom serializers.
ActivationView
does not care aboutself.serializer.data
but if it would care about that then the customization would be straightforward.