Is there any way to execute code in a rule or hook or anything when a login attempt fails? I know it gets logged and that can be accessed via management api but it would be very helpful to handle the event when it occurs rather than periodically checking for the events.
Updated with use case:
In the simplest case, I want to send an alert email when a user fails to login both as a means of proactive help desk and also addressing potential security concerns immediately. But, the flexibility for executable code to run rather than an email template would be ideal.