There are now "hooks" (in Moodle 3.8) which allow you to poke your own code into login pages. I have never tried it. Just read about it. Sounds cool
https://tracker.moodle.org/browse/MDL-66173
https://tracker.moodle.org/browse/MDL-66173