I found a solution to the problem, see this forum post:
Re: How to implement wrong login credentials message on custom login page
by Davi DePaula -
Number of replies: 0