diff --git a/rest_auth/serializers.py b/rest_auth/serializers.py index 723cfca..0fa9687 100644 --- a/rest_auth/serializers.py +++ b/rest_auth/serializers.py @@ -239,12 +239,12 @@ class PasswordChangeSerializer(serializers.Serializer): ) super(PasswordChangeSerializer, self).__init__(*args, **kwargs) - if not self.old_password_field_enabled: - self.fields.pop('old_password') - self.request = self.context.get('request') self.user = getattr(self.request, 'user', None) + if not self.old_password_field_enabled or not self.user.has_usable_password(): + self.fields.pop('old_password') + def validate_old_password(self, value): invalid_password_conditions = ( self.old_password_field_enabled,