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); }
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; }
/** * Returns the PUT response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPut($record) { $this->configService->update((int) $this->getUriFragment('config_id'), $record->value); return array('success' => true, 'message' => 'Config successful updated'); }
/** * Returns the GET response * * @return array|\PSX\Record\RecordInterface */ protected function doGet() { return $this->configService->getAll($this->getParameter('startIndex', Validate::TYPE_INTEGER) ?: 0, $this->getParameter('search', Validate::TYPE_STRING) ?: null); }