Tivix / django-rest-auth

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
www.tivix.com
MIT License
2.41k stars 661 forks source link

Django axes integration in demo project #555

Open GabLeRoux opened 5 years ago

GabLeRoux commented 5 years ago

Hi, I'm not sure this should actually get merged as I think there should be a better solution to support this, but I managed to get django-axes working with django-rest-auth in the demo project this way (so this way is compatible with latest version of django-rest-auth.

A better solution would be to check for django-axes and see if it's installed, then implement the logic I added in serializers.py into the django-rest-auth library instead of the demo.

I also added a few tests while doing it. So most changes are in demo folder. The only exception is an update in docs folder if this ever get merged. It's safe to merge this, the fix in the library would need to clean the demo project.

image

Without the serializers.py changes, the django-axes works, but the error is not sent back in non_field_errors so if a user is locked out, he still gets the 'Unable to log in with provided credentials.' message.

This relates to #477

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 96.044% when pulling b3d07028ca5ac4d798b2c0415eea044e7d7c9b2c on GabLeRoux:django-axes-demo into 624ad01afbc86fa15b4e652406f3bdcd01f36e00 on Tivix:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 96.044% when pulling b3d07028ca5ac4d798b2c0415eea044e7d7c9b2c on GabLeRoux:django-axes-demo into 624ad01afbc86fa15b4e652406f3bdcd01f36e00 on Tivix:master.