mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
fixes for validating expense_mailbox in company request
This commit is contained in:
parent
13dae4f524
commit
1f92ea0108
@ -76,7 +76,7 @@ class UpdateCompanyRequest extends Request
|
|||||||
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9.-]+[a-zA-Z0-9]$/', new ValidSubdomain()];
|
$rules['subdomain'] = ['nullable', 'regex:/^[a-zA-Z0-9.-]+[a-zA-Z0-9]$/', new ValidSubdomain()];
|
||||||
}
|
}
|
||||||
|
|
||||||
$rules['expense_mailbox'] = new ValidExpenseMailbox();
|
$rules['expense_mailbox'] = ['email', 'nullable', new ValidExpenseMailbox()];
|
||||||
|
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ namespace App\Http\ValidationRules\Company;
|
|||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use Illuminate\Contracts\Validation\Rule;
|
use Illuminate\Contracts\Validation\Rule;
|
||||||
|
use Symfony\Component\Validator\Constraints\EmailValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ValidCompanyQuantity.
|
* Class ValidCompanyQuantity.
|
||||||
@ -47,7 +48,7 @@ class ValidExpenseMailbox implements Rule
|
|||||||
// Validate Schema
|
// Validate Schema
|
||||||
$validated = false;
|
$validated = false;
|
||||||
foreach ($this->endings as $ending) {
|
foreach ($this->endings as $ending) {
|
||||||
if (str_ends_with($ending, $value)) {
|
if (str_ends_with($value, $ending)) {
|
||||||
$validated = true;
|
$validated = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ class MultiDB
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!config('ninja.db.multi_db_enabled')) {
|
if (!config('ninja.db.multi_db_enabled')) {
|
||||||
return Company::where("expense_mailbox", $expense_mailbox)->exists();
|
return !Company::where("expense_mailbox", $expense_mailbox)->exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($expense_mailbox, self::$protected_expense_mailboxes)) {
|
if (in_array($expense_mailbox, self::$protected_expense_mailboxes)) {
|
||||||
|
@ -210,8 +210,8 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'inbound_mailbox_allow_vendors' => (bool) $company->inbound_mailbox_allow_vendors,
|
'inbound_mailbox_allow_vendors' => (bool) $company->inbound_mailbox_allow_vendors,
|
||||||
'inbound_mailbox_allow_clients' => (bool) $company->inbound_mailbox_allow_clients,
|
'inbound_mailbox_allow_clients' => (bool) $company->inbound_mailbox_allow_clients,
|
||||||
'inbound_mailbox_allow_unknown' => (bool) $company->inbound_mailbox_allow_unknown,
|
'inbound_mailbox_allow_unknown' => (bool) $company->inbound_mailbox_allow_unknown,
|
||||||
'inbound_mailbox_blacklist' => $company->inbound_mailbox_blacklist,
|
'inbound_mailbox_blacklist' => (string) $company->inbound_mailbox_blacklist,
|
||||||
'inbound_mailbox_whitelist' => $company->inbound_mailbox_whitelist,
|
'inbound_mailbox_whitelist' => (string) $company->inbound_mailbox_whitelist,
|
||||||
'smtp_host' => (string) $company->smtp_host ?? '',
|
'smtp_host' => (string) $company->smtp_host ?? '',
|
||||||
'smtp_port' => (int) $company->smtp_port ?? 25,
|
'smtp_port' => (int) $company->smtp_port ?? 25,
|
||||||
'smtp_encryption' => (string) $company->smtp_encryption ?? 'tls',
|
'smtp_encryption' => (string) $company->smtp_encryption ?? 'tls',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user