1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

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();
$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)