mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactor authentication methods in RegisterOrLogin component
This commit is contained in:
parent
f004282310
commit
d2a95c2915
@ -93,7 +93,7 @@ class RegisterOrLogin extends Component
|
|||||||
session()->flash('message', 'These credentials do not match our records.');
|
session()->flash('message', 'These credentials do not match our records.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function withOtp()
|
public function withOtp(): void
|
||||||
{
|
{
|
||||||
$contact = ClientContact::where('email', $this->email)
|
$contact = ClientContact::where('email', $this->email)
|
||||||
->where('company_id', $this->subscription->company_id)
|
->where('company_id', $this->subscription->company_id)
|
||||||
@ -128,7 +128,7 @@ class RegisterOrLogin extends Component
|
|||||||
$this->state['otp_form'] = true;
|
$this->state['otp_form'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleOtp()
|
public function handleOtp(): void
|
||||||
{
|
{
|
||||||
$this->validate([
|
$this->validate([
|
||||||
'otp' => 'required|numeric|digits:6',
|
'otp' => 'required|numeric|digits:6',
|
||||||
@ -160,7 +160,7 @@ class RegisterOrLogin extends Component
|
|||||||
$this->registerForm();
|
$this->registerForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function register(array $data)
|
public function register(array $data): void
|
||||||
{
|
{
|
||||||
$service = new ClientRegisterService(
|
$service = new ClientRegisterService(
|
||||||
company: $this->subscription->company,
|
company: $this->subscription->company,
|
||||||
@ -190,7 +190,7 @@ class RegisterOrLogin extends Component
|
|||||||
);
|
);
|
||||||
|
|
||||||
$client = $service->createClient([]);
|
$client = $service->createClient([]);
|
||||||
$contact = $service->createClientContact([], $client);
|
$contact = $service->createClientContact(['email' => $this->email], $client);
|
||||||
|
|
||||||
auth()->guard('contact')->loginUsingId($contact->id, true);
|
auth()->guard('contact')->loginUsingId($contact->id, true);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user