Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions server/src/Mail/CustomerCredentialsMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ public function content(): Content
private function getCustomerPortalAccessUrl(): string
{
$customerPortalConfig = Setting::lookupForCompany($this->customer->company_uuid, 'customer-portal-config');
$accessUrlSlug = data_get($customerPortalConfig, 'accessUrlSlug', 'customer-portal');
$accessUrlSlug = data_get($customerPortalConfig, 'accessUrlSlug');

return Utils::consoleUrl($accessUrlSlug ?: 'customer-portal');
// The portal resolves a company's access slug under /customer-access/{slug};
// without one, send the customer to the portal's own sign-in route.
return Utils::consoleUrl($accessUrlSlug ? 'customer-access/' . $accessUrlSlug : 'customer-portal');
}
}
2 changes: 1 addition & 1 deletion server/tests/NotificationAndMailContractsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,5 +704,5 @@ public function track(Order $order, mixed $options): array

$content = fleetOpsNotificationWithEnvironment(fn () => (new CustomerCredentialsMail('plain-secret', $customer))->content());

expect($content->with['customerPortalUrl'])->toBe('https://console.fleetbase.test/acme-portal');
expect($content->with['customerPortalUrl'])->toBe('https://console.fleetbase.test/customer-access/acme-portal');
})->with([null, 'other-company']);
Loading