From 02e8201b105fc2c5a29343ef7815941473f2cd63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Fri, 8 Mar 2024 19:37:29 +0100 Subject: [PATCH] Add check for existing client contact in withOtp() method --- .../BillingPortal/Authentication/RegisterOrLogin.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Livewire/BillingPortal/Authentication/RegisterOrLogin.php b/app/Livewire/BillingPortal/Authentication/RegisterOrLogin.php index 3034b1fb0fd7..5b3c32c43dfa 100644 --- a/app/Livewire/BillingPortal/Authentication/RegisterOrLogin.php +++ b/app/Livewire/BillingPortal/Authentication/RegisterOrLogin.php @@ -95,6 +95,16 @@ class RegisterOrLogin extends Component public function withOtp() { + $contact = ClientContact::where('email', $this->email) + ->where('company_id', $this->subscription->company_id) + ->first(); + + if ($contact === null) { + $this->state['register_form'] = true; + + return; + } + $code = rand(100000, 999999); $email_hash = "subscriptions:otp:{$this->email}";