mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-08-07 10:01:47 -04:00
Add email validation and check for existing customer in Login component
This commit is contained in:
parent
022a36c394
commit
d8ffb804d9
@ -41,7 +41,17 @@ class Login extends Component
|
|||||||
|
|
||||||
public function initial()
|
public function initial()
|
||||||
{
|
{
|
||||||
$this->validateOnly('email', ['email' => 'required|bail|email:rfc|exists:client_contacts,email']);
|
$this->validateOnly('email', ['email' => 'required|bail|email:rfc|email']);
|
||||||
|
|
||||||
|
$contact = ClientContact::where('email', $this->email)
|
||||||
|
->where('company_id', $this->subscription->company_id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($contact === null) {
|
||||||
|
$this->addError('email', ctrans('texts.checkout_only_for_existing_customers'));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->state['initial_completed'] = true;
|
$this->state['initial_completed'] = true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user