Adding code from Limit Login Attempts version 1.7.1.