Jeremy Corbyn will scrap controls on immigration and hand foreign nationals the right to vote in future elections and referendums if Labour wins power.