The French parliament has passed legislation toughening France's immigration policy after months of political wrangling.