1
0
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:
David Bomba 2023-10-18 15:54:55 +11:00
parent cdcfcf715c
commit e41228a115
3 changed files with 38 additions and 2 deletions

View File

@ -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 {

View File

@ -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()
{

View File

@ -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();