Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dba20752 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

Merge branch '3757-Add_origin_on_curl_requests' into 'main'

Add origin header on newsletter POST /singnup request

See merge request !181
parents b9f931b9 254c2845
Loading
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ class NewsLetterService {

	private function signupForNewsletter(string $userEmail, array $listIds, string $userLanguage): void {
		$newsletterApiUrl = $this->config->getSystemValue('newsletter_base_url', '');
		$origin = (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'];

		if (empty($newsletterApiUrl)) {
			return;
@@ -70,7 +71,8 @@ class NewsLetterService {
		$params_string = json_encode($params);
		$headers = [
			'Content-Type: application/json',
			'Content-Length: ' . strlen($params_string)
			'Content-Length: ' . strlen($params_string),
			'Origin: ' . $origin
		];
		$this->curl->post($url, $params, $headers);