We need to catch the login data that have extra information as captcha inputs and more. When we do login we lost this $_POST information in loginListener so we can't process some data to the database.
The only function that we found to implement some code to access to the database before login and catch some POST data in it, is at the attemptAuthentication function of UsernamePasswordFormAuthenticationListener class, in file:
vendor/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php
But it is core code and we think is a bad practice if we have to modify this.
We need to find a BeforeLogin function and file in Symfony 2 to implement the database access code.
You can register a listener for
SecurityEvents::INTERACTIVE_LOGIN
and get the request from the event object.