iMerica / dj-rest-auth

Authentication for Django Rest Framework
https://dj-rest-auth.readthedocs.io/en/latest/index.html
MIT License
1.64k stars 306 forks source link

registration.views.RegisterView.get_response_data() should return data when REST_SESSION_LOGIN=True #444

Open edmundsj opened 1 year ago

edmundsj commented 1 year ago

Issue: I am using session-based login and creating a new user with dj-rest-auth. The user is created successfully after hitting the registration endpoint, and I verify that in my database. I expect a 201 status code to be returned, but instead a 204 status code is returned. It looks like the reason for this is that registration.views.RegisterView.get_response_data() is returningNone` when it should return some serialized data - I suspect the new code should be something like this:

elif getattr(settings, 'REST_SESSION_LOGIN', True):
    data = {'user': user}
    return UserDetailsSerializer(user)
edmundsj commented 1 year ago

Also, should the line getattr(settings, 'REST_USE_JWT', False) be getattr(settings, 'REST_USE_JWT', True)?

shalgrim commented 10 months ago

There seems to be a discussion about this same issue over at Stack Overflow