private function resetPasswordNotification(Entity\Users $userEntity, $shadowPassword, $shadowToken)
    {
        $config = $this->app['config'];
        $flash = $this->app['logger.flash'];
        $mailer = $this->app['mailer'];
        $logger = $this->app['logger.system'];
        $twig = $this->app['twig'];
        $urlGenerator = $this->app['url_generator'];

        $shadowLink = $urlGenerator->generate(
            'resetpassword',
            ['token' => $shadowToken],
            UrlGeneratorInterface::ABSOLUTE_URL
        );

        // Compile the email with the shadow password and reset link.
        $mailHtml = $twig->render(
            '@bolt/mail/passwordreset.twig',
            [
                'user'           => $userEntity,
                'shadowpassword' => $shadowPassword,
                'shadowtoken'    => $shadowToken,
                'shadowvalidity' => Carbon::now()->addHours(2)->format('Y-m-d H:i:s'),
                'shadowlink'     => $shadowLink,
            ]
        );

        $subject = sprintf('[ Bolt / %s ] Password reset.', $config->get('general/sitename'));
        $name = $config->get('general/mailoptions/senderName', $config->get('general/sitename'));
        $email = $config->get('general/mailoptions/senderMail', $userEntity->getEmail());
        $from = [$email => $name];

        $message = $mailer
            ->createMessage('message')
            ->setSubject($subject)
            ->setFrom($from)
            ->setReplyTo($from)
            ->setTo([$userEntity->getEmail() => $userEntity->getDisplayname()])
            ->setBody(strip_tags($mailHtml))
            ->addPart($mailHtml, 'text/html')
        ;

        $failed = true;
        $failedRecipients = [];

        try {
            $recipients = $mailer->send($message, $failedRecipients);

            // Try and send immediately
            $this->app['swiftmailer.spooltransport']->getSpool()->flushQueue($this->app['swiftmailer.transport']);

            if ($recipients) {
                $logger->info("Password request sent to '" . $userEntity->getDisplayname() . "'.", ['event' => 'authentication']);
                $failed = false;
            }
        } catch (\Exception $e) {
            // Notify below
        }

        if ($failed) {
            $logger->error("Failed to send password request sent to '" . $userEntity['displayname'] . "'.", ['event' => 'authentication']);
            $flash->error(Trans::__('general.phrase.error-send-password-request'));
        }
    }
private function resetPasswordNotification(Entity\Users $userEntity, $shadowPassword, $shadowToken)
    {
        $config = $this->app['config'];
        $flash = $this->app['logger.flash'];
        $mailer = $this->app['mailer'];
        $logger = $this->app['logger.system'];
        $twig = $this->app['twig'];
        $urlGenerator = $this->app['url_generator'];

        $shadowLink = $urlGenerator->generate(
            'resetpassword',
            ['token' => $shadowToken],
            UrlGeneratorInterface::ABSOLUTE_URL
        );

        // Compile the email with the shadow password and reset link.
        $mailHtml = $twig->render(
            '@bolt/mail/passwordreset.twig',
            [
                'user'           => $userEntity,
                'shadowpassword' => $shadowPassword,
                'shadowtoken'    => $shadowToken,
                'shadowvalidity' => Carbon::now()->addHours(2)->format('Y-m-d H:i:s'),
                'shadowlink'     => $shadowLink,
            ]
        );

        $subject = sprintf('[ Bolt / %s ] Password reset.', $config->get('general/sitename'));
        $name = $config->get('general/mailoptions/senderName', $config->get('general/sitename'));
        $email = $config->get('general/mailoptions/senderMail', $userEntity->getEmail());
        $from = [$email => $name];

        $message = $mailer
            ->createMessage('message')
            ->setSubject($subject)
            ->setFrom($from)
            ->setReplyTo($from)
            ->setTo([$userEntity->getEmail() => $userEntity->getDisplayname()])
            ->setBody(strip_tags($mailHtml))
            ->addPart($mailHtml, 'text/html')
        ;

        $failed = true;
        $failedRecipients = [];

        try {
            $recipients = $mailer->send($message, $failedRecipients);

            // Try and send immediately
            $this->app['swiftmailer.spooltransport']->getSpool()->flushQueue($this->app['swiftmailer.transport']);

            if ($recipients) {
                $logger->info("Password request sent to '" . $userEntity->getDisplayname() . "'.", ['event' => 'authentication']);
                $failed = false;
            }
        } catch (\Exception $e) {
            // Notify below
        }

        if ($failed) {
            $logger->error("Failed to send password request sent to '" . $userEntity['displayname'] . "'.", ['event' => 'authentication']);
            $flash->error(Trans::__('general.phrase.error-send-password-request'));
        }
    }
private function resetPasswordNotification ( Entity \ Users $ userEntity , $ shadowPassword , $ shadowToken ) { $ config = $ this -> app [ 'config' ] ; $ flash = $ this -> app [ 'logger.flash' ] ; $ mailer = $ this -> app [ 'mailer' ] ; $ logger = $ this -> app [ 'logger.system' ] ; $ twig = $ this -> app [ 'twig' ] ; $ urlGenerator = $ this -> app [ 'url_generator' ] ; $ shadowLink = $ urlGenerator -> generate ( 'resetpassword' , [ 'token' => $ shadowToken ] , UrlGeneratorInterface :: ABSOLUTE_URL ) ; // Compile the email with the shadow password and reset link. $ mailHtml = $ twig -> render ( '@bolt/mail/passwordreset.twig' , [ 'user' => $ userEntity , 'shadowpassword' => $ shadowPassword , 'shadowtoken' => $ shadowToken , 'shadowvalidity' => Carbon :: now ( ) -> addHours ( 2 ) -> format ( 'Y-m-d H:i:s' ) , 'shadowlink' => $ shadowLink , ] ) ; $ subject = sprintf ( '[ Bolt / %s ] Password reset.' , $ config -> get ( 'general/sitename' ) ) ; $ name = $ config -> get ( 'general/mailoptions/senderName' , $ config -> get ( 'general/sitename' ) ) ; $ email = $ config -> get ( 'general/mailoptions/senderMail' , $ userEntity -> getEmail ( ) ) ; $ from = [ $ email => $ name ] ; $ message = $ mailer -> createMessage ( 'message' ) -> setSubject ( $ subject ) -> setFrom ( $ from ) -> setReplyTo ( $ from ) -> setTo ( [ $ userEntity -> getEmail ( ) => $ userEntity -> getDisplayname ( ) ] ) -> setBody ( strip_tags ( $ mailHtml ) ) -> addPart ( $ mailHtml , 'text/html' ) ; $ failed = true ; $ failedRecipients = [ ] ; try { $ recipients = $ mailer -> send ( $ message , $ failedRecipients ) ; // Try and send immediately $ this -> app [ 'swiftmailer.spooltransport' ] -> getSpool ( ) -> flushQueue ( $ this -> app [ 'swiftmailer.transport' ] ) ; if ( $ recipients ) { $ logger -> info ( "Password request sent to '" . $ userEntity -> getDisplayname ( ) . "'." , [ 'event' => 'authentication' ] ) ; $ failed = false ; } } catch ( \ Exception $ e ) { // Notify below } if ( $ failed ) { $ logger -> error ( "Failed to send password request sent to '" . $ userEntity [ 'displayname' ] . "'." , [ 'event' => 'authentication' ] ) ; $ flash -> error ( Trans :: __ ( 'general.phrase.error-send-password-request' ) ) ; } }
Send the password reset link notification to the user.

@param Entity\Users $userEntity
@param string       $shadowPassword
@param string       $shadowToken
Send the password reset link notification to the user .