mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
81cf9ace95
@ -1 +1 @@
|
||||
5.2.17
|
||||
5.2.18
|
@ -54,6 +54,7 @@ class StoreClientRequest extends Request
|
||||
/* Ensure we have a client name, and that all emails are unique*/
|
||||
//$rules['name'] = 'required|min:1';
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
$rules['contacts'] = 'array';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'nullable',
|
||||
|
@ -62,6 +62,7 @@ class UpdateClientRequest extends Request
|
||||
$rules['number'] = Rule::unique('clients')->where('company_id', auth()->user()->company()->id)->ignore($this->client->id);
|
||||
|
||||
$rules['settings'] = new ValidClientGroupSettingsRule();
|
||||
$rules['contacts'] = 'array';
|
||||
$rules['contacts.*.email'] = 'bail|nullable|distinct|sometimes|email';
|
||||
$rules['contacts.*.password'] = [
|
||||
'nullable',
|
||||
|
@ -14,8 +14,8 @@ return [
|
||||
'require_https' => env('REQUIRE_HTTPS', true),
|
||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
|
||||
'app_version' => '5.2.17',
|
||||
'app_tag' => '5.2.17',
|
||||
'app_version' => '5.2.18',
|
||||
'app_tag' => '5.2.18',
|
||||
'minimum_client_version' => '5.0.16',
|
||||
'terms_version' => '1.0.1',
|
||||
'api_secret' => env('API_SECRET', ''),
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<!-- Source: https://github.com/invoiceninja/invoiceninja -->
|
||||
<!-- Version: {{ config('ninja.app_version') }} -->
|
||||
<base href="/">
|
||||
<base href="{{ $_SERVER['REQUEST_URI'] }}">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="google-signin-client_id" content="{{ config('services.google.client_id') }}">
|
||||
<link rel="manifest" href="manifest.json?v={{ config('ninja.app_version') }}">
|
||||
|
@ -263,6 +263,63 @@ class ClientTest extends TestCase
|
||||
$this->assertEquals($this->client->contacts->count(), 3);
|
||||
}
|
||||
|
||||
public function testClientCreationWithIllegalContactObject()
|
||||
{
|
||||
|
||||
$account = Account::factory()->create();
|
||||
$company = Company::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
]);
|
||||
|
||||
$account->default_company_id = $company->id;
|
||||
$account->save();
|
||||
|
||||
$user = User::factory()->create([
|
||||
'account_id' => $account->id,
|
||||
'confirmation_code' => $this->createDbHash(config('database.default')),
|
||||
'email' => 'whiz@gmail.com',
|
||||
|
||||
]);
|
||||
|
||||
$user->companies()->attach($company->id, [
|
||||
'account_id' => $account->id,
|
||||
'is_owner' => 1,
|
||||
'is_admin' => 1,
|
||||
'notifications' => CompanySettings::notificationDefaults(),
|
||||
'permissions' => '',
|
||||
'settings' => '',
|
||||
'is_locked' => 0,
|
||||
]);
|
||||
|
||||
$company_token = new CompanyToken;
|
||||
$company_token->user_id = $user->id;
|
||||
$company_token->company_id = $company->id;
|
||||
$company_token->account_id = $account->id;
|
||||
$company_token->name = $user->first_name.' '.$user->last_name;
|
||||
$company_token->token = Str::random(64);
|
||||
$company_token->save();
|
||||
|
||||
$this->token = $company_token->token;
|
||||
|
||||
|
||||
$data = [
|
||||
'name' => 'A loyal Client',
|
||||
'contacts' => $this->faker->unique()->safeEmail,
|
||||
];
|
||||
|
||||
try{
|
||||
$response = $this->withHeaders([
|
||||
'X-API-SECRET' => config('ninja.api_secret'),
|
||||
'X-API-TOKEN' => $this->token,
|
||||
])->post('/api/v1/clients/', $data);
|
||||
}catch (ValidationException $e) {
|
||||
$message = json_decode($e->validator->getMessageBag(), 1);
|
||||
$this->assertNotNull($message);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testCreatingClientAndContacts()
|
||||
{
|
||||
$account = Account::factory()->create();
|
||||
|
Loading…
x
Reference in New Issue
Block a user