コード例 #1
0
 /**
  * Hook which sends a notification on a published notification failure
  *
  * @param AuthenticationAttemptEvent $event
  */
 public function onAuthenticationFailure(AuthenticationAttemptEvent $event)
 {
     $user = $event->getUser();
     $report = $event->getReport();
     $defaultParameters = ['user' => $user, 'override_locale' => true];
     if (1 < ($attempts = $report->getAttempts())) {
         $defaultParameters['content'] = 'notification.auth.failures';
         $defaultParameters['parameters'] = ['translation_defaults' => ['%times%' => $attempts]];
     } else {
         $defaultParameters['content'] = 'notification.auth.single_failure';
     }
     $this->publisher->createAndPublish('sen_mailer', $defaultParameters);
 }