Add check for existing client contact in withOtp() method

This commit is contained in:
Benjamin Beganović 2024-03-08 19:37:29 +01:00
parent e3f1520ba9
commit 02e8201b10

View File

@ -95,6 +95,16 @@ class RegisterOrLogin extends Component
public function withOtp() 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); $code = rand(100000, 999999);
$email_hash = "subscriptions:otp:{$this->email}"; $email_hash = "subscriptions:otp:{$this->email}";