Limit the rate of login attempts.

Needs more tests.