/**
  * @param AuthenticationFailureEvent $event
  * @param array $default
  * @return array
  */
 public function resolve($event, $default = array())
 {
     if (!$event instanceof AuthenticationFailureEvent) {
         return $default;
     }
     return $this->getEventDetailsArray("Authentication Failed", 'Bad credentials Username: %s', $event->getAuthenticationToken()->getUser());
 }
 /**
  * onAuthenticationFailure
  *
  * @param 	AuthenticationFailureEvent $event
  */
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     // executes on failed login
     $request = $this->container->get('request');
     $type = Incident::$SECURITY_INCIDENT_LOGIN_FAILURE;
     $token = $event->getAuthenticationToken();
     $username = strval($token->getUser());
     $this->registerSecurityIncident($request, $type, $username);
 }
 /**
  * onAuthenticationFailure
  *
  * @param 	AuthenticationFailureEvent $event
  */
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     $token = $event->getAuthenticationToken();
     $userName = $token->getUsername();
     $user = $this->em->getRepository('AppBundle:users')->findOneBy(array('username' => $userName));
     if ($user) {
         $user->setLoginAttempts($user->getLoginAttempts() + 1);
         $this->em->persist($user);
         $this->em->flush();
     }
 }
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     $token = $event->getAuthenticationToken();
     /* @var $user User */
     $user = $this->container->get('logic')->getUserByName($token->getUsername());
     if ($user) {
         $attempts = $user->getAttempts();
         $attempts++;
         $user->setAttempts($attempts);
         if ($attempts > 5) {
             $user->setLocked(true);
             $this->logger->addWarning("User account " . $user->getUsername() . " is locked.");
         }
         $this->em->flush();
     }
 }
示例#5
0
 /**
  * This is called when an interactive authentication attempt fails. This is
  * called by authentication listeners inheriting from
  * AbstractAuthenticationListener.
  *
  * @param AuthenticationFailureEvent $event Event triggering this callback.
  *
  * @return Response
  */
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     /** @var \Symfony\Component\Security\Core\Exception\AuthenticationException $exception */
     $exception = $event->getAuthenticationException();
     $this->logger->warning($exception->getMessageKey(), array('data' => $exception->getMessageData()));
 }
 /**
  * @param AuthenticationFailureEvent $event
  * @return array
  */
 private function getEventDetails(AuthenticationFailureEvent $event)
 {
     return $this->getEventDetailsArray($event->getAuthenticationToken()->getUser());
 }
 /**
  * 
  * @param AuthenticationFailureEvent $event
  * @throws AuthenticationException
  */
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     throw new AuthenticationException($event->getAuthenticationException());
 }
 /**
  * @param AuthenticationFailureEvent $event Authentication failure event
  */
 public function onAuthenticationFailure(AuthenticationFailureEvent $event)
 {
     if (is_a($event->getAuthenticationException(), 'Symfony\\Component\\Security\\Core\\Exception\\BadCredentialsException')) {
         drupal_set_message(t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => array('name' => $event->getAuthenticationToken()->getUser()))))), 'error');
     }
 }