Reputation: 3297
How can I add logic to Symfony2's authentication method?
for example, blocking one's login attempts after certain amount of failed logins.
Upvotes: 1
Views: 1767
Reputation: 44831
You can do it in an authentication handler. Here is an example of an authentication handler which you can adapt to your needs.
Upvotes: 1
Reputation: 1460
You should define service that implements Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface
and in method onAuthenticationFailure()
you can increase attribute which handle number of attempts. If number reach limit you just switch user attribute enabled
to false
Upvotes: 0