Once you login to moodle using admin, search for a setting named Alternate Login URL. You need to set this to your custom login page. Moodle will automatically redirect to your page in case username/password is wrong.
Authentication
Custom Auth Plugin for Login - Wrong Credentials
This discussion has been locked so you can no longer reply to it.