/**
  * Get authentication
  *
  * @param boolean $isConfirmRequest
  *
  * @return void
  */
 protected function authenticate($isConfirmRequest = FALSE)
 {
     $code = $this->getAuthCode();
     /* @var $subscriber Subscriber */
     $subscriber = $this->subscriberRepository->findByCode($code, !$isConfirmRequest);
     if ($subscriber === NULL) {
         $this->processError('authFailed');
     }
     $modify = '+1 hour';
     if (isset($this->settings['subscriptionManager']['subscriber']['emailHashTimeout'])) {
         $modify = trim($this->settings['subscriptionManager']['subscriber']['emailHashTimeout']);
     }
     if ($subscriber->isAuthCodeExpired($modify)) {
         $this->processError('linkOutdated');
     }
     if ($isConfirmRequest === TRUE) {
         $confirmedSubscriptions = $this->subscriberRepository->findExistingSubscriptions($subscriber->getPostUid(), $subscriber->getEmail(), $subscriber->getUid());
         if (count($confirmedSubscriptions) > 0) {
             $subscriber->_setProperty('deleted', TRUE);
             $this->subscriberRepository->update($subscriber);
             $this->persistEntities();
             $this->processError('alreadyRegistered', FlashMessage::NOTICE);
         }
     }
     $this->authentication->login($subscriber->getEmail());
     $this->subscriber = $subscriber;
 }
 /**
  * Send comment notification mails
  *
  * @param Comment $comment
  *
  * @return    void
  */
 protected function notifySubscribers(Comment $comment)
 {
     $settings = $this->settings['subscriptionManager']['subscriber'];
     if (!$settings['enableNewCommentNotifications']) {
         return;
     }
     if ($comment->getMailsSent()) {
         return;
     }
     $this->log->dev('Send subscriber notification mails.');
     /* @var $post Post */
     $post = $comment->getPost();
     $subscribers = $this->subscriberRepository->findForNotification($post);
     $subject = $this->translate('subject.subscriber.notify', $post->getTitle());
     /* @var $subscriber Subscriber */
     foreach ($subscribers as $subscriber) {
         // make sure we do not notify the author of the triggering comment
         if ($comment->getEmail() === $subscriber->getEmail()) {
             continue;
         }
         $subscriber->updateAuth();
         $this->subscriberRepository->update($subscriber);
         $variables = array('post' => $post, 'comment' => $comment, 'subscriber' => $subscriber, 'subject' => $subject, 'validUntil' => $this->getValidUntil());
         $emailBody = $this->emailService->render($variables, 'SubscriberNewCommentMail.txt');
         $this->emailService->send($subscriber->getMailTo(), array($settings['mailFrom']['email'] => $settings['mailFrom']['name']), $subject, $emailBody);
     }
     $comment->setMailsSent(TRUE);
     $this->objectManager->get('TYPO3\\T3extblog\\Domain\\Repository\\CommentRepository')->update($comment);
 }