From 891c742c5d359656bac0f6612036827cad46f42d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 24 Nov 2022 09:33:25 +1100 Subject: [PATCH] Fixes for custom client portal subdomains --- app/Http/Requests/Company/UpdateCompanyRequest.php | 4 ++-- app/Utils/Traits/Inviteable.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Requests/Company/UpdateCompanyRequest.php b/app/Http/Requests/Company/UpdateCompanyRequest.php index 16efe91040ea..08d1c89bd94d 100644 --- a/app/Http/Requests/Company/UpdateCompanyRequest.php +++ b/app/Http/Requests/Company/UpdateCompanyRequest.php @@ -74,9 +74,9 @@ class UpdateCompanyRequest extends Request $input = $this->all(); - if (Ninja::isHosted() && array_key_exists('portal_domain', $input) && strlen($input['portal_domain']) > 1) { + if (array_key_exists('portal_domain', $input) && strlen($input['portal_domain']) > 1) { $input['portal_domain'] = $this->addScheme($input['portal_domain']); - $input['portal_domain'] = strtolower($input['portal_domain']); + $input['portal_domain'] = rtrim(strtolower($input['portal_domain']), "/"); } if (array_key_exists('settings', $input)) { diff --git a/app/Utils/Traits/Inviteable.php b/app/Utils/Traits/Inviteable.php index 8b6481bd1ff0..d2ac6eca9c6c 100644 --- a/app/Utils/Traits/Inviteable.php +++ b/app/Utils/Traits/Inviteable.php @@ -95,7 +95,7 @@ trait Inviteable if (Ninja::isHosted()) { $domain = $this->company->domain(); } else { - $domain = config('ninja.app_url'); + $domain = strlen($this->company->portal_domain) > 5 ? $this->company->portal_domain : config('ninja.app_url'); } switch ($this->company->portal_mode) {