mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Minor fixes for client request validation
This commit is contained in:
parent
f168895507
commit
1356b3d7ad
@ -41,6 +41,10 @@ class ContactKeyLogin
|
||||
|
||||
if ($request->segment(2) && $request->segment(2) == 'magic_link' && $request->segment(3)) {
|
||||
$payload = Cache::get($request->segment(3));
|
||||
|
||||
if(!$payload)
|
||||
abort(403, 'Link expired.');
|
||||
|
||||
$contact_email = $payload['email'];
|
||||
|
||||
if($client_contact = ClientContact::where('email', $contact_email)->where('company_id', $payload['company_id'])->first()){
|
||||
|
@ -74,7 +74,6 @@ class StoreClientRequest extends Request
|
||||
$rules['number'] = ['nullable',Rule::unique('clients')->where('company_id', auth()->user()->company()->id)];
|
||||
$rules['id_number'] = ['nullable',Rule::unique('clients')->where('company_id', auth()->user()->company()->id)];
|
||||
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,10 @@ class Request extends FormRequest
|
||||
|
||||
if (isset($input['contacts']) && is_array($input['contacts'])) {
|
||||
foreach ($input['contacts'] as $key => $contact) {
|
||||
|
||||
if(!is_array($contact))
|
||||
continue;
|
||||
|
||||
if (array_key_exists('id', $contact) && is_numeric($contact['id'])) {
|
||||
unset($input['contacts'][$key]['id']);
|
||||
} elseif (array_key_exists('id', $contact) && is_string($contact['id'])) {
|
||||
@ -154,6 +158,7 @@ class Request extends FormRequest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user