From c62b2bec7dea6cf524aa730f0342424b7540a008 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 24 May 2021 08:25:14 +1000 Subject: [PATCH] Constrain by company_id --- app/Http/Livewire/BillingPortalPurchase.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index a1614a3cc65d..8a42098b2090 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -181,14 +181,16 @@ class BillingPortalPurchase extends Component { $this->validate(); - $contact = ClientContact::where('email', $this->email)->first(); + $contact = ClientContact::where('email', $this->email) + ->where('company_id', $this->subscription->company_id) + ->first(); if ($contact && $this->steps['existing_user'] === false) { return $this->steps['existing_user'] = true; } if ($contact && $this->steps['existing_user']) { - $attempt = Auth::guard('contact')->attempt(['email' => $this->email, 'password' => $this->password]); + $attempt = Auth::guard('contact')->attempt(['email' => $this->email, 'password' => $this->password, 'company_id' => $this->subscription->company_id]); return $attempt ? $this->getPaymentMethods($contact)