/** * @param UserDataEvent $event */ public function onRequestedPassword(UserDataEvent $event) { $user = $event->getUser(); $token = $this->tokenGenerator->generateToken(); $this->userManager->updateConfirmationTokenUser($user, $token); $message = \Swift_Message::newInstance()->setCharset('UTF-8')->setSubject($this->templating->loadTemplate($this->template)->renderBlock('subject', []))->setFrom($this->from)->setTo($user->getEmail())->setBody($this->templating->loadTemplate($this->template)->renderBlock('body', ['username' => $user->getUsername(), 'request_link' => $this->router->generate('reset_password', ['token' => $token], true)])); $this->mailer->send($message); }
/** * @param UserDataEvent $event */ public function onNewAccountCreated(UserDataEvent $event) { $message = \Swift_Message::newInstance()->setCharset('UTF-8')->setSubject($this->templating->loadTemplate($this->template)->renderBlock('subject', []))->setFrom($this->from)->setTo($event->getUser()->getEmail())->setBody($this->templating->loadTemplate($this->template)->renderBlock('body', ['username' => $event->getUser()->getUsername()])); $this->mailer->send($message); }