mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 00:11:35 +02:00
Fixes for null/not set client contact passwords
This commit is contained in:
parent
cdcfcf715c
commit
e41228a115
@ -180,7 +180,7 @@ class Request extends FormRequest
|
||||
}
|
||||
|
||||
//Filter the client contact password - if it is sent with ***** we should ignore it!
|
||||
if (isset($contact['password'])) {
|
||||
if (isset($contact['password']) && is_string($contact['password'])) {
|
||||
if (strlen($contact['password']) == 0) {
|
||||
$input['contacts'][$key]['password'] = '';
|
||||
} else {
|
||||
|
@ -65,6 +65,34 @@ class ClientTest extends TestCase
|
||||
$this->makeTestData();
|
||||
}
|
||||
|
||||
public function testStoreClientFixes()
|
||||
{
|
||||
$data = [
|
||||
"contacts" => [
|
||||
[
|
||||
"email" => "tenda@gmail.com",
|
||||
"first_name" => "Tenda",
|
||||
"is_primary" => True,
|
||||
"last_name" => "Bavuma",
|
||||
"password" => null,
|
||||
"send_email" => True
|
||||
],
|
||||
],
|
||||
"country_id" => "356",
|
||||
"display_name" => "Tenda Bavuma",
|
||||
"name" => "Tenda Bavuma",
|
||||
"shipping_country_id" => "356",
|
||||
];
|
||||
|
||||
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->postJson('/api/v1/clients', $data);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testClientMergeContactDrop()
|
||||
{
|
||||
|
||||
|
@ -33,7 +33,7 @@ class InvoiceEmailTest extends TestCase
|
||||
use GeneratesCounter;
|
||||
|
||||
public $faker;
|
||||
|
||||
|
||||
protected function setUp() :void
|
||||
{
|
||||
parent::setUp();
|
||||
@ -50,6 +50,14 @@ class InvoiceEmailTest extends TestCase
|
||||
|
||||
}
|
||||
|
||||
public function testInvalidEmailParsing()
|
||||
{
|
||||
$email = 'illegal@example.com';
|
||||
|
||||
$this->assertTrue(strpos($email, '@example.com') !== false);
|
||||
}
|
||||
|
||||
|
||||
public function testClientEmailHistory()
|
||||
{
|
||||
$system_log = new SystemLog();
|
||||
|
Loading…
Reference in New Issue
Block a user