Listener/AuthenticationLoggerListener.php
public function logFailure(AuthenticationFailureEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();

        $exception = $event->getAuthenticationException()
            ->getPrevious();
        if (null === $exception) {
            $exception = $event->getAuthenticationException();
        }

        $authLog = $this->createAuthLog();
        $authLog->setSuccess(false);
        $authLog->setUsername($request->request->get('_username'));
        $authLog->setMessage($exception->getMessage());

        $this->em->persist($authLog);
        $this->em->flush();
    }
public function logFailure(AuthenticationFailureEvent $event)
    {
        $request = $this->requestStack->getCurrentRequest();

        $exception = $event->getAuthenticationException()
            ->getPrevious();
        if (null === $exception) {
            $exception = $event->getAuthenticationException();
        }

        $authLog = $this->createAuthLog();
        $authLog->setSuccess(false);
        $authLog->setUsername($request->request->get('_username'));
        $authLog->setMessage($exception->getMessage());

        $this->em->persist($authLog);
        $this->em->flush();
    }
public function logFailure ( AuthenticationFailureEvent $ event ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ exception = $ event -> getAuthenticationException ( ) -> getPrevious ( ) ; if ( null === $ exception ) { $ exception = $ event -> getAuthenticationException ( ) ; } $ authLog = $ this -> createAuthLog ( ) ; $ authLog -> setSuccess ( false ) ; $ authLog -> setUsername ( $ request -> request -> get ( '_username' ) ) ; $ authLog -> setMessage ( $ exception -> getMessage ( ) ) ; $ this -> em -> persist ( $ authLog ) ; $ this -> em -> flush ( ) ; }
Logs a failed login.

@param AuthenticationFailureEvent $event
Logs a failed login .