From 3ca24d395de96c7df1ff23886457a3595eaa82fd Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Mon, 20 Nov 2023 00:22:51 +0800 Subject: [PATCH] Fixed passwords not being saved on registration --- equipment_tracker/accounts/serializers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/equipment_tracker/accounts/serializers.py b/equipment_tracker/accounts/serializers.py index f862d18..d878cce 100644 --- a/equipment_tracker/accounts/serializers.py +++ b/equipment_tracker/accounts/serializers.py @@ -43,3 +43,10 @@ class UserRegistrationSerializer(serializers.ModelSerializer): ) return super().validate(attrs) + + def create(self, validated_data): + user = self.Meta.model(**validated_data) + user.set_password(validated_data['password']) + user.save() + + return user