Open ThomasEnglish opened 1 year ago
Actually this behaviour is caused by inconsistent of some default value settings in dj_rest_auth. After 3.0.0, all settings are now consistent. I notice this changed behaviour, but forgot to add the documentation about this. Thanks for raising this issue. We should add documentation to set SESSION_LOGIN=False
explicitly if TokenSerializer
used or fix the code maybe?
Can you move the settings inside of the REST_AUTH dict @ThomasEnglish ?
In LoginView, Response serializer data is set even if SESSION_LOGIN=True
.
It may be better to have the same behavior in LoginView
and RegisterView
.
Personally, I would like TokenSerializer
data to be set in RegisterView
even if SESSION_LOGIN=True.
Or, it would be great if it could be set in settings.py
without having to create our own View.
When:
TOKEN_SERIALIZER
is setSESSION_LOGIN
is not setUSE_JWT
is not setPrior Behaviour - Version
2.2.8
:dj_rest_auth.registration.views.RegisterView.get_response_data()
would returnTokenSerializer(user.auth_token, context=self.get_serializer_context()).data
: PermalinkCurrent Behaviour -
3.0.0
:dj_rest_auth.registration.views.RegisterView.get_response_data()
returnsNone
: PermalinkThe change in behaviour caught me out, as the response returned by RegisterView is now
204 - No Content
, rather than201 - Created
with the data from the TokenSerializer.I've explicitly set
SESSION_LOGIN = False
to fix this in our project, but thought I'd raise an issue here as it was unexpected.