From 922b4ad7a840f304f58c7cd018edf925fa83a713 Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Tue, 6 Oct 2026 14:30:34 +0800 Subject: [PATCH] fix(mail): link customer credentials to /customer-access/{slug} The customer portal resolves a company's access slug only under /customer-access/{slug}; the credentials email linked /{slug}, which the console does not route. Without a configured slug the link still points at the portal's own /customer-portal sign-in. --- server/src/Mail/CustomerCredentialsMail.php | 6 ++++-- server/tests/NotificationAndMailContractsTest.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/Mail/CustomerCredentialsMail.php b/server/src/Mail/CustomerCredentialsMail.php index af197524e..331fd564f 100644 --- a/server/src/Mail/CustomerCredentialsMail.php +++ b/server/src/Mail/CustomerCredentialsMail.php @@ -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'); } } diff --git a/server/tests/NotificationAndMailContractsTest.php b/server/tests/NotificationAndMailContractsTest.php index 8539b5620..0e3e01016 100644 --- a/server/tests/NotificationAndMailContractsTest.php +++ b/server/tests/NotificationAndMailContractsTest.php @@ -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']);