0

I extended the AbstractUser class, and then added a password2 field for password validation. However, in my admin page, my password2 field displays as plain text, instead of a hashed value just like the AbstractUser password field. I'd want my password2 value to be hashed as well. How can that be done, please.

User Model:

class UserProfile(AbstractUser):
    profile_image = models.FileField(upload_to="profile_img")
    password2 = models.CharField(max_length=350, default="")

SignUp serializer:

class SignUpSerializer(serializers.ModelSerializer):
    password2 = serializers.CharField(style={'input_type': 'password'}, write_only=True)

    class Meta:
        model = UserProfile
        fields = ('username', 'password', 'password2', 'email',)
``
Marvelous Ikechi
  • 2,031
  • 2
  • 15
  • 26

0 Answers0