The need to override this behavior in Sitecore is common. Reflector is your best friend. Find the class in the code for the login page and find it. In most cases, you do not need to try to recreate it by cutting and pasting a lot of code. You can simply create a new class of the same type that inherits the input class, and then simply override the one method in which the action takes place. When finished, modify the .aspx file to refer to a new class that will be built into your own assembly instead of the Sitecore.dll file.
However, sometimes, if you just want to change something cosmetic, like an error message (which really does not require any logic in the background), you may be much better served by the one-time part of javascript on the page, hiding the default error message, when it appears, and displays its own custom div style and message. Do everything with the least amount of moving parts.
source share