Пример #1
0
 /**
  *
  * @access public
  * @param  \Symfony\Component\HttpFoundation\Request                                                     $request
  * @param  \Symfony\Component\Security\Core\Exception\AuthenticationException                            $exception
  * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
  */
 public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
 {
     // Get the visitors IP address and attempted username.
     $ipAddress = $request->getClientIp();
     if ($request->request->has('_username')) {
         $username = $request->request->get('_username');
     } else {
         $username = '';
     }
     // Make a note of the failed login.
     $this->loginFailureTracker->addAttempt($ipAddress, $username);
     // Let Symfony decide what to do next
     return parent::onAuthenticationFailure($request, $exception);
 }