mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
More strict date validation
This commit is contained in:
@@ -66,8 +66,8 @@ class Request extends FormRequest
|
|||||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||||
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
||||||
'amount' => ['nullable', new IsValidPositiveAmount()],
|
'amount' => ['nullable', new IsValidPositiveAmount()],
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date',
|
'end' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -78,9 +78,9 @@ class StoreRequest extends FormRequest
|
|||||||
'amount_max' => ['required', new IsValidPositiveAmount()],
|
'amount_max' => ['required', new IsValidPositiveAmount()],
|
||||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||||
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
||||||
'date' => 'date|required',
|
'date' => 'date|required|after:1900-01-01|before:2099-12-31',
|
||||||
'end_date' => 'nullable|date|after:date',
|
'end_date' => 'nullable|date|after:date|after:1900-01-01|before:2099-12-31',
|
||||||
'extension_date' => 'nullable|date|after:date',
|
'extension_date' => 'nullable|date|after:date|after:1900-01-01|before:2099-12-31',
|
||||||
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly|required',
|
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly|required',
|
||||||
'skip' => 'min:0|max:31|numeric',
|
'skip' => 'min:0|max:31|numeric',
|
||||||
'active' => [new IsBoolean()],
|
'active' => [new IsBoolean()],
|
||||||
|
@@ -81,9 +81,9 @@ class UpdateRequest extends FormRequest
|
|||||||
'amount_max' => ['nullable', new IsValidPositiveAmount()],
|
'amount_max' => ['nullable', new IsValidPositiveAmount()],
|
||||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||||
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
||||||
'date' => 'date',
|
'date' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end_date' => 'date|after:date',
|
'end_date' => 'date|after:date|after:1900-01-01|before:2099-12-31',
|
||||||
'extension_date' => 'date|after:date',
|
'extension_date' => 'date|after:date|after:1900-01-01|before:2099-12-31',
|
||||||
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly',
|
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly',
|
||||||
'skip' => 'min:0|max:31|numeric',
|
'skip' => 'min:0|max:31|numeric',
|
||||||
'active' => [new IsBoolean()],
|
'active' => [new IsBoolean()],
|
||||||
|
@@ -67,8 +67,8 @@ class UpdateRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date',
|
'end' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'amount' => ['nullable', new IsValidPositiveAmount()],
|
'amount' => ['nullable', new IsValidPositiveAmount()],
|
||||||
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
'currency_id' => 'numeric|exists:transaction_currencies,id',
|
||||||
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
|
||||||
|
@@ -154,7 +154,7 @@ class UpdateRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'title' => sprintf('min:1|max:255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
|
'title' => sprintf('min:1|max:255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
|
||||||
'description' => 'min:1|max:32768',
|
'description' => 'min:1|max:32768',
|
||||||
'first_date' => 'date',
|
'first_date' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'apply_rules' => [new IsBoolean()],
|
'apply_rules' => [new IsBoolean()],
|
||||||
'active' => [new IsBoolean()],
|
'active' => [new IsBoolean()],
|
||||||
'repeat_until' => 'nullable|date',
|
'repeat_until' => 'nullable|date',
|
||||||
|
@@ -71,8 +71,8 @@ class TestRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after_or_equal:start',
|
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
|
||||||
'accounts' => '',
|
'accounts' => '',
|
||||||
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||||
];
|
];
|
||||||
|
@@ -65,8 +65,8 @@ class TriggerRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after_or_equal:start',
|
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
|
||||||
'accounts' => '',
|
'accounts' => '',
|
||||||
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
|
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
|
||||||
];
|
];
|
||||||
|
@@ -65,8 +65,8 @@ class TestRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after_or_equal:start',
|
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
|
||||||
'accounts' => '',
|
'accounts' => '',
|
||||||
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
|
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
|
||||||
];
|
];
|
||||||
|
@@ -69,8 +69,8 @@ class TriggerRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after_or_equal:start',
|
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -62,7 +62,7 @@ class StoreRequest extends FormRequest
|
|||||||
$rules = [
|
$rules = [
|
||||||
'tag' => 'required|min:1|uniqueObjectForUser:tags,tag|max:1024',
|
'tag' => 'required|min:1|uniqueObjectForUser:tags,tag|max:1024',
|
||||||
'description' => 'min:1|nullable|max:32768',
|
'description' => 'min:1|nullable|max:32768',
|
||||||
'date' => 'date|nullable',
|
'date' => 'date|nullable|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
|
|
||||||
return Location::requestRules($rules);
|
return Location::requestRules($rules);
|
||||||
|
@@ -66,7 +66,7 @@ class UpdateRequest extends FormRequest
|
|||||||
$rules = [
|
$rules = [
|
||||||
'tag' => 'min:1|max:1024|uniqueObjectForUser:tags,tag,'.$tag->id,
|
'tag' => 'min:1|max:1024|uniqueObjectForUser:tags,tag,'.$tag->id,
|
||||||
'description' => 'min:1|nullable|max:32768',
|
'description' => 'min:1|nullable|max:32768',
|
||||||
'date' => 'date|nullable',
|
'date' => 'date|nullable|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
|
|
||||||
return Location::requestRules($rules);
|
return Location::requestRules($rules);
|
||||||
|
@@ -68,7 +68,7 @@ class CronRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'force' => 'in:true,false',
|
'force' => 'in:true,false',
|
||||||
'date' => 'date',
|
'date' => 'nullable|date|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -109,8 +109,8 @@ class InfiniteListRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after:start',
|
'end' => 'date|after:start|after:1900-01-01|before:2099-12-31',
|
||||||
'start_row' => 'integer|min:0|max:4294967296',
|
'start_row' => 'integer|min:0|max:4294967296',
|
||||||
'end_row' => 'integer|min:0|max:4294967296|gt:start_row',
|
'end_row' => 'integer|min:0|max:4294967296|gt:start_row',
|
||||||
];
|
];
|
||||||
|
@@ -84,8 +84,8 @@ class ListRequest extends FormRequest
|
|||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'start' => 'date',
|
'start' => 'date|after:1900-01-01|before:2099-12-31',
|
||||||
'end' => 'date|after:start',
|
'end' => 'date|after:start|after:1900-01-01|before:2099-12-31',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user