mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-18 15:39:50 +00:00
Update some code, add security txt file.
This commit is contained in:
@@ -68,9 +68,9 @@ class AccountFormRequest extends Request
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$accountRoles = join(',', config('firefly.accountRoles'));
|
||||
$types = join(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = join(',', array_keys(config('firefly.ccTypes')));
|
||||
$accountRoles = implode(',', config('firefly.accountRoles'));
|
||||
$types = implode(',', array_keys(config('firefly.subTitlesByIdentifier')));
|
||||
$ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes')));
|
||||
$rules = [
|
||||
'name' => 'required|min:1|uniqueAccountForUser',
|
||||
'openingBalance' => 'numeric|required_with:openingBalanceDate|nullable',
|
||||
|
||||
@@ -40,13 +40,14 @@ class ExportFormRequest extends Request
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$sessionFirst = clone session('first');
|
||||
$first = $sessionFirst->subDay()->format('Y-m-d');
|
||||
$today = Carbon::create()->addDay()->format('Y-m-d');
|
||||
$formats = join(',', array_keys(config('firefly.export_formats')));
|
||||
$formats = implode(',', array_keys(config('firefly.export_formats')));
|
||||
|
||||
// fixed
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class JournalLinkRequest extends Request
|
||||
$return = [];
|
||||
$linkType = $this->get('link_type');
|
||||
$parts = explode('_', $linkType);
|
||||
$return['link_type_id'] = intval($parts[0]);
|
||||
$return['link_type_id'] = (int)$parts[0];
|
||||
$return['transaction_journal_id'] = $this->integer('link_journal_id');
|
||||
$return['notes'] = strlen($this->string('notes')) > 0 ? $this->string('notes') : '';
|
||||
$return['direction'] = $parts[1];
|
||||
@@ -70,7 +70,7 @@ class JournalLinkRequest extends Request
|
||||
$combinations[] = sprintf('%d_inward', $type->id);
|
||||
$combinations[] = sprintf('%d_outward', $type->id);
|
||||
}
|
||||
$string = join(',', $combinations);
|
||||
$string = implode(',', $combinations);
|
||||
|
||||
// fixed
|
||||
return [
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class CategoryFormRequest.
|
||||
@@ -124,6 +125,7 @@ class ReportFormRequest extends Request
|
||||
$date = new Carbon($parts[1]);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date range.', $range));
|
||||
throw new FireflyException(sprintf('"%s" is not a valid date range.', $range));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
@@ -170,6 +172,7 @@ class ReportFormRequest extends Request
|
||||
$date = new Carbon($parts[0]);
|
||||
// @codeCoverageIgnoreStart
|
||||
} catch (Exception $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date range.', $range));
|
||||
throw new FireflyException(sprintf('"%s" is not a valid date range.', $range));
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class RuleFormRequest extends Request
|
||||
$validActions = array_keys(config('firefly.rule-actions'));
|
||||
|
||||
// some actions require text:
|
||||
$contextActions = join(',', config('firefly.rule-actions-text'));
|
||||
$contextActions = implode(',', config('firefly.rule-actions-text'));
|
||||
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title';
|
||||
if (null !== $repository->find(intval($this->get('id')))->id) {
|
||||
@@ -82,9 +82,9 @@ class RuleFormRequest extends Request
|
||||
'stop_processing' => 'boolean',
|
||||
'rule_group_id' => 'required|belongsToUser:rule_groups',
|
||||
'trigger' => 'required|in:store-journal,update-journal',
|
||||
'rule-trigger.*' => 'required|in:' . join(',', $validTriggers),
|
||||
'rule-trigger.*' => 'required|in:' . implode(',', $validTriggers),
|
||||
'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue',
|
||||
'rule-action.*' => 'required|in:' . join(',', $validActions),
|
||||
'rule-action.*' => 'required|in:' . implode(',', $validActions),
|
||||
];
|
||||
// since Laravel does not support this stuff yet, here's a trick.
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
|
||||
@@ -41,6 +41,7 @@ class SelectTransactionsRequest extends Request
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
|
||||
@@ -154,11 +154,9 @@ class SplitJournalFormRequest extends Request
|
||||
$transactions = $data['transactions'] ?? [];
|
||||
/** @var array $array */
|
||||
foreach ($transactions as $array) {
|
||||
if ($array['destination_id'] !== null && $array['source_id'] !== null) {
|
||||
if ($array['destination_id'] === $array['source_id']) {
|
||||
$validator->errors()->add('journal_source_account_id', trans('validation.source_equals_destination'));
|
||||
$validator->errors()->add('journal_destination_account_id', trans('validation.source_equals_destination'));
|
||||
}
|
||||
if ($array['destination_id'] !== null && $array['source_id'] !== null && $array['destination_id'] === $array['source_id']) {
|
||||
$validator->errors()->add('journal_source_account_id', trans('validation.source_equals_destination'));
|
||||
$validator->errors()->add('journal_destination_account_id', trans('validation.source_equals_destination'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class TestRuleFormRequest extends Request
|
||||
// fixed
|
||||
$validTriggers = array_keys(config('firefly.rule-triggers'));
|
||||
$rules = [
|
||||
'rule-trigger.*' => 'required|min:1|in:' . join(',', $validTriggers),
|
||||
'rule-trigger.*' => 'required|min:1|in:' . implode(',', $validTriggers),
|
||||
'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue',
|
||||
];
|
||||
|
||||
|
||||
@@ -43,10 +43,8 @@ class TokenFormRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
// fixed
|
||||
$rules = [
|
||||
return [
|
||||
'code' => 'required|2faCode',
|
||||
];
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user