From 754f11cb518578f2306adad2b2f1398b2240e977 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 21 Mar 2017 15:42:12 +0200 Subject: [PATCH] Merge white label fix --- .../Requests/SaveClientPortalSettings.php | 20 ++++++++++--------- .../views/partials/white_label.blade.php | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/Http/Requests/SaveClientPortalSettings.php b/app/Http/Requests/SaveClientPortalSettings.php index 7886722ae2f6..94d6fba71a5d 100644 --- a/app/Http/Requests/SaveClientPortalSettings.php +++ b/app/Http/Requests/SaveClientPortalSettings.php @@ -41,15 +41,17 @@ class SaveClientPortalSettings extends Request $input['client_view_css'] = HTMLUtils::sanitize($this->client_view_css); } - if ($this->custom_link == 'subdomain') { - $subdomain = substr(strtolower($input['subdomain']), 0, MAX_SUBDOMAIN_LENGTH); - $input['subdomain'] = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', $subdomain); - $input['iframe_url'] = null; - } else { - $iframeURL = substr(strtolower($input['iframe_url']), 0, MAX_IFRAME_URL_LENGTH); - $iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', $iframeURL); - $input['iframe_url'] = rtrim($iframeURL, '/'); - $input['subdomain'] = null; + if (Utils::isNinja()) { + if ($this->custom_link == 'subdomain') { + $subdomain = substr(strtolower($input['subdomain']), 0, MAX_SUBDOMAIN_LENGTH); + $input['subdomain'] = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', $subdomain); + $input['iframe_url'] = null; + } else { + $iframeURL = substr(strtolower($input['iframe_url']), 0, MAX_IFRAME_URL_LENGTH); + $iframeURL = preg_replace('/[^a-zA-Z0-9_\-\:\/\.]/', '', $iframeURL); + $input['iframe_url'] = rtrim($iframeURL, '/'); + $input['subdomain'] = null; + } } $this->replace($input); diff --git a/resources/views/partials/white_label.blade.php b/resources/views/partials/white_label.blade.php index 2ce579e774d0..9babd2ef7af1 100644 --- a/resources/views/partials/white_label.blade.php +++ b/resources/views/partials/white_label.blade.php @@ -84,7 +84,7 @@ } function buyProduct(affiliateKey, productId) { - window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/buy_now/?account_key=AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT&product_id=' + productId + '&contact_key={{ Auth::user()->primaryAccount()->account_key }}' + '&redirect_url=' + window.location); + window.open('{{ Utils::isNinjaDev() ? '' : NINJA_APP_URL }}/buy_now/?account_key={{ NINJA_LICENSE_ACCOUNT_KEY }}&product_id=' + productId + '&contact_key={{ Auth::user()->primaryAccount()->account_key }}' + '&redirect_url=' + window.location.href); } function showApplyLicense() {