Constrain by company_id

This commit is contained in:
David Bomba 2021-05-24 08:25:14 +10:00
parent a0211acc59
commit c62b2bec7d

View File

@ -181,14 +181,16 @@ class BillingPortalPurchase extends Component
{ {
$this->validate(); $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) { if ($contact && $this->steps['existing_user'] === false) {
return $this->steps['existing_user'] = true; return $this->steps['existing_user'] = true;
} }
if ($contact && $this->steps['existing_user']) { 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 return $attempt
? $this->getPaymentMethods($contact) ? $this->getPaymentMethods($contact)