From ba0eec48a0ac567d2c1e9ab605cfd35f12c99c35 Mon Sep 17 00:00:00 2001 From: Carrnell Technical Solutions <47834646+CarrnellTech@users.noreply.github.com> Date: Sun, 5 May 2024 15:05:46 -0500 Subject: [PATCH 1/2] Redirect client to dashboard at login if enabled --- app/Http/Controllers/Auth/ContactLoginController.php | 4 +++- .../Controllers/ClientPortal/ContactHashLoginController.php | 4 +++- app/Http/Middleware/ContactKeyLogin.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Auth/ContactLoginController.php b/app/Http/Controllers/Auth/ContactLoginController.php index f3e658f631c1..0c387a666405 100644 --- a/app/Http/Controllers/Auth/ContactLoginController.php +++ b/app/Http/Controllers/Auth/ContactLoginController.php @@ -165,7 +165,9 @@ class ContactLoginController extends Controller private function setRedirectPath() { - if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { + if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) { + $this->redirectTo = '/client/dashboard'; + } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { $this->redirectTo = '/client/invoices'; } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) { $this->redirectTo = '/client/recurring_invoices'; diff --git a/app/Http/Controllers/ClientPortal/ContactHashLoginController.php b/app/Http/Controllers/ClientPortal/ContactHashLoginController.php index 11bbbb47a426..6567996e1d05 100644 --- a/app/Http/Controllers/ClientPortal/ContactHashLoginController.php +++ b/app/Http/Controllers/ClientPortal/ContactHashLoginController.php @@ -64,7 +64,9 @@ class ContactHashLoginController extends Controller private function setRedirectPath() { - if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { + if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) { + return '/client/dashboard'; + } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { return '/client/invoices'; } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) { return '/client/recurring_invoices'; diff --git a/app/Http/Middleware/ContactKeyLogin.php b/app/Http/Middleware/ContactKeyLogin.php index 953d07f13290..ce3711dbccc0 100644 --- a/app/Http/Middleware/ContactKeyLogin.php +++ b/app/Http/Middleware/ContactKeyLogin.php @@ -161,7 +161,9 @@ class ContactKeyLogin private function setRedirectPath() { - if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { + if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) { + return '/client/dashboard'; + } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { return '/client/invoices'; } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) { return '/client/recurring_invoices'; From 49dc84884163ae22d605a75d9387dc619f05eb9b Mon Sep 17 00:00:00 2001 From: CarrnellTech <47834646+CarrnellTech@users.noreply.github.com> Date: Wed, 8 May 2024 23:41:01 +0000 Subject: [PATCH 2/2] Revert unnecessary changes --- .../Controllers/ClientPortal/ContactHashLoginController.php | 4 +--- app/Http/Middleware/ContactKeyLogin.php | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ClientPortal/ContactHashLoginController.php b/app/Http/Controllers/ClientPortal/ContactHashLoginController.php index 6567996e1d05..11bbbb47a426 100644 --- a/app/Http/Controllers/ClientPortal/ContactHashLoginController.php +++ b/app/Http/Controllers/ClientPortal/ContactHashLoginController.php @@ -64,9 +64,7 @@ class ContactHashLoginController extends Controller private function setRedirectPath() { - if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) { - return '/client/dashboard'; - } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { + if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { return '/client/invoices'; } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) { return '/client/recurring_invoices'; diff --git a/app/Http/Middleware/ContactKeyLogin.php b/app/Http/Middleware/ContactKeyLogin.php index ce3711dbccc0..953d07f13290 100644 --- a/app/Http/Middleware/ContactKeyLogin.php +++ b/app/Http/Middleware/ContactKeyLogin.php @@ -161,9 +161,7 @@ class ContactKeyLogin private function setRedirectPath() { - if (auth()->guard('contact')->user()->client->getSetting('enable_client_portal_dashboard') === true) { - return '/client/dashboard'; - } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { + if (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES) { return '/client/invoices'; } elseif (auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_RECURRING_INVOICES) { return '/client/recurring_invoices';