Quantcast
Channel: Why isn't my Django User Model's Password Hashed? - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by neferpitou for Why isn't my Django User Model's Password Hashed?

Here is an alternative to accepted answer.class CreateUserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('email', 'username', 'password') extra_kwargs = {'password':...

View Article


Answer by suhailvs for Why isn't my Django User Model's Password Hashed?

This worked for me.class UserSerializer(serializers.ModelSerializer): def create(self, *args, **kwargs): user = super().create(*args, **kwargs) p = user.password user.set_password(p) user.save() return...

View Article


Answer by spectras for Why isn't my Django User Model's Password Hashed?

The issue is DRF will simply set the field values onto the model. Therefore, the password is set on the password field, and saved in the database. But to properly set a password, you need to call the...

View Article

Answer by DRC for Why isn't my Django User Model's Password Hashed?

just override the create and update methods of the serializer: def create(self, validated_data): user = get_user_model(**validated_data) user.set_password(validated_data['password']) user.save() return...

View Article

Why isn't my Django User Model's Password Hashed?

I am using the Django REST Framework (DRF) to create an endpoint with which I can register new users. However, when I hit the creation endpoint with a POST, the new user is saved via a serializer, but...

View Article

Browsing latest articles
Browse All 5 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>