def validate(self, data):
    'Check credentials'
    user = authenticate(username=data['email'], password=data['password'])
    if (not user):
        raise serializers.ValidationError('Invalid credentials')
    if (not user.is_verified):
        raise serializers.ValidationError('Account is not active yet')
    self.context['user'] = user
    return data
Check credentials
def validate(self, data):
    
    user = authenticate(username=data['email'], password=data['password'])
    if (not user):
        raise serializers.ValidationError('Invalid credentials')
    if (not user.is_verified):
        raise serializers.ValidationError('Account is not active yet')
    self.context['user'] = user
    return data