Beispiel #1
0
 public function send($subject, array $to, $body)
 {
     $message = \Swift_Message::newInstance();
     $message->setSubject($subject);
     $sender = $this->config->getValue('mail_sender');
     if (!empty($sender)) {
         $message->setFrom([$sender]);
     }
     $message->setTo($to);
     $message->setBody($body);
     $this->logger->info('Send registration mail', ['subject' => $subject, 'body' => $body]);
     $this->mailer->send($message);
 }
Beispiel #2
0
 protected function sendActivationMail($userId, $name, $email)
 {
     $payload = ['sub' => $userId, 'exp' => time() + 60 * 60];
     $token = JWT::encode($payload, $this->psxConfig->get('fusio_project_key'));
     $subject = $this->config->getValue('mail_register_subject');
     $body = $this->config->getValue('mail_register_body');
     $values = array('name' => $name, 'email' => $email, 'token' => $token);
     foreach ($values as $key => $value) {
         $body = str_replace($key, $value, $body);
     }
     $this->mailer->send($subject, [$email], $body);
 }
 public function getPreFilter()
 {
     $isPublic = $this->getActiveMethod()->public;
     $filter = array();
     // it is required for every request to have an user agent which
     // identifies the client
     $filter[] = new UserAgentEnforcer();
     // cors header
     $allowOrigin = $this->configService->getValue('cors_allow_origin');
     if (!empty($allowOrigin)) {
         $filter[] = new CORS($allowOrigin);
     }
     if (!$isPublic) {
         $filter[] = new Oauth2Filter($this->connection, $this->request->getMethod(), $this->context->get('fusio.routeId'), function ($accessToken) {
             $this->appId = $accessToken['appId'];
             $this->userId = $accessToken['userId'];
         });
     }
     return $filter;
 }