diff --git a/app/Constants/Domain.php b/app/Constants/Domain.php index d8a0ff9b04..613d89f62b 100644 --- a/app/Constants/Domain.php +++ b/app/Constants/Domain.php @@ -2,6 +2,8 @@ namespace App\Constants; +use App\Libraries\Utils; + class Domain { const INVOICENINJA_COM = 1; @@ -28,4 +30,17 @@ class Domain { return 'maildelivery@' . static::getDomainFromId($id); } + + public static function getCookieDomain($url) + { + if (! Utils::isNinjaProd() || Utils::isReseller()) { + return ''; + } + + if (strpos($url, '.services') !== false) { + return '.invoice.services'; + } else { + return '.invoiceninja.com'; + } + } } diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index e25fbcf2e2..2b62a0c975 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -219,7 +219,7 @@ }, }, "cookie": { - "domain": "{{ config('session.domain') }}" + "domain": "{{ App\Constants\Domain::getCookieDomain(request()->url) }}" }, "content": { "href": "{{ Utils::isNinja() ? Utils::getPrivacyLink() : (config('ninja.privacy_policy_url') ?: 'https://cookiesandyou.com/' ) }}",