No, it was *NOT* legal, because corruption of the election renders the election null and void regardless of what "authorities" pronounce it to be.
There is nothing in the Constitution that ties the appointment of Electors to popular vote elections.