Cool off period

These commits fix two problems with the cool off period, the first is that after the access attempts were deleted, an old version of the queryset was returned, which caused users being blocked while they should've been granted access.

The second is that the failure counter for trusted users wasn't reset after the cooloff period was over.

I've also included two unit tests, which test for these issues.