Custom Serializer Problem
See original GitHub issueI am using custom Registration serializer, here it is:
#settings.py
REST_AUTH_REGISTER_SERIALIZERS = { 'REGISTER_SERIALIZER': 'api.serializers.MyRegisterSerializer' }
#serializers.py
class MyRegisterSerializer(RegisterSerializer):
first_name = serializers.CharField()
last_name = serializers.CharField()
password = serializers.CharField(write_only=True)
password1 = password2 = password
def validate(self, data):
return data
def get_cleaned_data(self):
super(MyRegisterSerializer, self).get_cleaned_data()
return {
'username': self.validated_data.get('username', ''),
'password': self.validated_data.get('password', ''),
'email': self.validated_data.get('email', ''),
'first_name': self.validated_data.get('first_name', ''),
'last_name': self.validated_data.get('last_name', '')
}
Issue is : i am getting an unknown !
prepended to my password, hence forth my password is unrecogonized during login.
With using MYREGISTERSERIALIZER : password = !HnBxoehpig…
without using MYREGISTERSERIALIZER:
password = pbkdf2_sha256…
i know password depends on many factors (SALT, Datetime and so), but my presumption is may this is the issue that causing me login problems as all the signups done with custom serializer has this !
prepended.
Kindly check the root cause.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Custom Serializer Not Called For Array Or Collection Types
You need to properly register your custom serialiser using MixIn feature. Instead of annotating property, you need to annotate class which ...
Read more >@JsonUnwrapped does not work with a custom Serializer ...
Since now, my Serializer works fine and everything is good. The problem is with another entity "Order" which has Payment as a property...
Read more >Calling Default Serializer from Custom Serializer in Jackson
A possible workaround is using BeanSerializerModifier to store the default serializer for the type Folder before Jackson internally overrides it ...
Read more >Serialization and Deserialization Issues in Spring REST
In Spring REST projects a custom implementation of MappingJackson2HttpMessageConverter helps to create the custom ObjectMapper , as seen below.
Read more >Spring Custom Serializers with @JsonIdentityInfo - NEX Softsys
If the object is complex and needs to customize the serialization/ deserialization then we need to write Custom Serializer which extends ...
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 FreeTop 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
Top GitHub Comments
@shakeelcse09
For Detailed Code, here it is https://github.com/deepak1725/djangular/blob/master/api/serializers.py
thank you deepak1725 it worked.