mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-24 06:43:23 +00:00
Rector code cleanup
This commit is contained in:
@@ -32,6 +32,7 @@ return RectorConfig::configure()
|
|||||||
])
|
])
|
||||||
->withPaths([
|
->withPaths([
|
||||||
// __DIR__ . '/../app',
|
// __DIR__ . '/../app',
|
||||||
|
__DIR__ . '/../app/Api',
|
||||||
__DIR__ . '/../app/Http',
|
__DIR__ . '/../app/Http',
|
||||||
// __DIR__ . '/../bootstrap',
|
// __DIR__ . '/../bootstrap',
|
||||||
// __DIR__ . '/../config',
|
// __DIR__ . '/../config',
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
|
||||||
|
|
||||||
|
use FireflyIII\Models\TransactionGroup;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
|
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
|
||||||
use FireflyIII\Enums\UserRoleEnum;
|
use FireflyIII\Enums\UserRoleEnum;
|
||||||
@@ -102,7 +103,7 @@ class TransactionController extends Controller
|
|||||||
if (is_numeric($data['query'])) {
|
if (is_numeric($data['query'])) {
|
||||||
// search for group, not journal.
|
// search for group, not journal.
|
||||||
$firstResult = $this->groupRepository->find((int) $data['query']);
|
$firstResult = $this->groupRepository->find((int) $data['query']);
|
||||||
if (null !== $firstResult) {
|
if ($firstResult instanceof TransactionGroup) {
|
||||||
// group may contain multiple journals, each a result:
|
// group may contain multiple journals, each a result:
|
||||||
foreach ($firstResult->transactionJournals as $journal) {
|
foreach ($firstResult->transactionJournals as $journal) {
|
||||||
$result->push($journal);
|
$result->push($journal);
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Chart;
|
namespace FireflyIII\Api\V1\Controllers\Chart;
|
||||||
|
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
|
use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
|
||||||
@@ -99,7 +100,7 @@ class AccountController extends Controller
|
|||||||
private function renderAccountData(array $params, Account $account): void
|
private function renderAccountData(array $params, Account $account): void
|
||||||
{
|
{
|
||||||
$currency = $this->repository->getAccountCurrency($account);
|
$currency = $this->repository->getAccountCurrency($account);
|
||||||
if (null === $currency) {
|
if (!$currency instanceof TransactionCurrency) {
|
||||||
$currency = $this->default;
|
$currency = $this->default;
|
||||||
}
|
}
|
||||||
$currentSet = [
|
$currentSet = [
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest;
|
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest;
|
||||||
use FireflyIII\Enums\UserRoleEnum;
|
use FireflyIII\Enums\UserRoleEnum;
|
||||||
@@ -59,11 +60,11 @@ class DestroyController extends Controller
|
|||||||
public function destroy(DestroyRequest $request, TransactionCurrency $from, TransactionCurrency $to): JsonResponse
|
public function destroy(DestroyRequest $request, TransactionCurrency $from, TransactionCurrency $to): JsonResponse
|
||||||
{
|
{
|
||||||
$date = $request->getDate();
|
$date = $request->getDate();
|
||||||
if (null === $date) {
|
if (!$date instanceof Carbon) {
|
||||||
throw new ValidationException('Date is required');
|
throw new ValidationException('Date is required');
|
||||||
}
|
}
|
||||||
$rate = $this->repository->getSpecificRateOnDate($from, $to, $date);
|
$rate = $this->repository->getSpecificRateOnDate($from, $to, $date);
|
||||||
if (null === $rate) {
|
if (!$rate instanceof CurrencyExchangeRate) {
|
||||||
throw new NotFoundHttpException();
|
throw new NotFoundHttpException();
|
||||||
}
|
}
|
||||||
$this->repository->deleteRate($rate);
|
$this->repository->deleteRate($rate);
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
|
||||||
|
|
||||||
|
use FireflyIII\Models\CurrencyExchangeRate;
|
||||||
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest;
|
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest;
|
||||||
use FireflyIII\Api\V2\Controllers\Controller;
|
use FireflyIII\Api\V2\Controllers\Controller;
|
||||||
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
|
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
|
||||||
@@ -61,11 +62,11 @@ class StoreController extends Controller
|
|||||||
|
|
||||||
// already has rate?
|
// already has rate?
|
||||||
$object = $this->repository->getSpecificRateOnDate($from, $to, $date);
|
$object = $this->repository->getSpecificRateOnDate($from, $to, $date);
|
||||||
if (null !== $object) {
|
if ($object instanceof CurrencyExchangeRate) {
|
||||||
// just update it, no matter.
|
// just update it, no matter.
|
||||||
$rate = $this->repository->updateExchangeRate($object, $rate, $date);
|
$rate = $this->repository->updateExchangeRate($object, $rate, $date);
|
||||||
}
|
}
|
||||||
if (null === $object) {
|
if (!$object instanceof CurrencyExchangeRate) {
|
||||||
// store new
|
// store new
|
||||||
$rate = $this->repository->storeExchangeRate($from, $to, $rate, $date);
|
$rate = $this->repository->storeExchangeRate($from, $to, $rate, $date);
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\RuleGroup;
|
namespace FireflyIII\Api\V1\Controllers\Models\RuleGroup;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Models\RuleGroup\TestRequest;
|
use FireflyIII\Api\V1\Requests\Models\RuleGroup\TestRequest;
|
||||||
use FireflyIII\Api\V1\Requests\Models\RuleGroup\TriggerRequest;
|
use FireflyIII\Api\V1\Requests\Models\RuleGroup\TriggerRequest;
|
||||||
@@ -128,7 +129,7 @@ class TriggerController extends Controller
|
|||||||
*
|
*
|
||||||
* Execute the given rule group on a set of existing transactions.
|
* Execute the given rule group on a set of existing transactions.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function triggerGroup(TriggerRequest $request, RuleGroup $group): JsonResponse
|
public function triggerGroup(TriggerRequest $request, RuleGroup $group): JsonResponse
|
||||||
{
|
{
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
|
namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
|
||||||
|
|
||||||
|
use Validator;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
@@ -74,15 +75,15 @@ class DestroyController extends Controller
|
|||||||
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
||||||
// access denied:
|
// access denied:
|
||||||
$messages = ['currency_code' => '200005: You need the "owner" role to do this.'];
|
$messages = ['currency_code' => '200005: You need the "owner" role to do this.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
if ($this->repository->currencyInUse($currency)) {
|
if ($this->repository->currencyInUse($currency)) {
|
||||||
$messages = ['currency_code' => '200006: Currency in use.'];
|
$messages = ['currency_code' => '200006: Currency in use.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
if ($this->repository->isFallbackCurrency($currency)) {
|
if ($this->repository->isFallbackCurrency($currency)) {
|
||||||
$messages = ['currency_code' => '200026: Currency is fallback.'];
|
$messages = ['currency_code' => '200026: Currency is fallback.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->repository->destroy($currency);
|
$this->repository->destroy($currency);
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLink;
|
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLink;
|
||||||
|
|
||||||
|
use FireflyIII\Models\TransactionJournal;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Models\TransactionLink\StoreRequest;
|
use FireflyIII\Api\V1\Requests\Models\TransactionLink\StoreRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -81,7 +82,7 @@ class StoreController extends Controller
|
|||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
$inward = $this->journalRepository->find($data['inward_id'] ?? 0);
|
$inward = $this->journalRepository->find($data['inward_id'] ?? 0);
|
||||||
$outward = $this->journalRepository->find($data['outward_id'] ?? 0);
|
$outward = $this->journalRepository->find($data['outward_id'] ?? 0);
|
||||||
if (null === $inward || null === $outward) {
|
if (!$inward instanceof TransactionJournal || !$outward instanceof TransactionJournal) {
|
||||||
throw new FireflyException('200024: Source or destination does not exist.');
|
throw new FireflyException('200024: Source or destination does not exist.');
|
||||||
}
|
}
|
||||||
$data['direction'] = 'inward';
|
$data['direction'] = 'inward';
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType;
|
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType;
|
||||||
|
|
||||||
|
use Validator;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Models\TransactionLinkType\StoreRequest;
|
use FireflyIII\Api\V1\Requests\Models\TransactionLinkType\StoreRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -81,7 +82,7 @@ class StoreController extends Controller
|
|||||||
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
||||||
// access denied:
|
// access denied:
|
||||||
$messages = ['name' => '200005: You need the "owner" role to do this.'];
|
$messages = ['name' => '200005: You need the "owner" role to do this.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
// if currency ID is 0, find the currency by the code:
|
// if currency ID is 0, find the currency by the code:
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType;
|
namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType;
|
||||||
|
|
||||||
|
use Validator;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Models\TransactionLinkType\UpdateRequest;
|
use FireflyIII\Api\V1\Requests\Models\TransactionLinkType\UpdateRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -85,7 +86,7 @@ class UpdateController extends Controller
|
|||||||
|
|
||||||
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
if (!$this->userRepository->hasRole($admin, 'owner')) {
|
||||||
$messages = ['name' => '200005: You need the "owner" role to do this.'];
|
$messages = ['name' => '200005: You need the "owner" role to do this.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\Summary;
|
namespace FireflyIII\Api\V1\Controllers\Summary;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\Data\DateRequest;
|
use FireflyIII\Api\V1\Requests\Data\DateRequest;
|
||||||
@@ -91,7 +92,7 @@ class BasicController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/summary/getBasicSummary
|
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/summary/getBasicSummary
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function basic(DateRequest $request): JsonResponse
|
public function basic(DateRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
@@ -467,7 +468,7 @@ class BasicController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
|
private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
|
||||||
{
|
{
|
||||||
@@ -674,15 +675,14 @@ class BasicController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function notInDateRange(Carbon $date, Carbon $start, Carbon $end): bool // Validate a preference
|
protected function notInDateRange(Carbon $date, Carbon $start, Carbon $end): bool // Validate a preference
|
||||||
{
|
{
|
||||||
$result = false;
|
|
||||||
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
||||||
$result = true;
|
return true;
|
||||||
}
|
}
|
||||||
// start and end in the past? use $end
|
// start and end in the past? use $end
|
||||||
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
|
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
|
||||||
$result = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Controllers\System;
|
namespace FireflyIII\Api\V1\Controllers\System;
|
||||||
|
|
||||||
|
use Validator;
|
||||||
use FireflyIII\Api\V1\Controllers\Controller;
|
use FireflyIII\Api\V1\Controllers\Controller;
|
||||||
use FireflyIII\Api\V1\Requests\System\UpdateRequest;
|
use FireflyIII\Api\V1\Requests\System\UpdateRequest;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -158,7 +159,7 @@ class ConfigurationController extends Controller
|
|||||||
$rules = ['value' => 'required'];
|
$rules = ['value' => 'required'];
|
||||||
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
|
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
|
||||||
$messages = ['value' => '200005: You need the "owner" role to do this.'];
|
$messages = ['value' => '200005: You need the "owner" role to do this.'];
|
||||||
\Validator::make([], $rules, $messages)->validate();
|
Validator::make([], $rules, $messages)->validate();
|
||||||
}
|
}
|
||||||
$data = $request->getAll();
|
$data = $request->getAll();
|
||||||
$shortName = str_replace('configuration.', '', $name);
|
$shortName = str_replace('configuration.', '', $name);
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Middleware;
|
namespace FireflyIII\Api\V1\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ class ApiDemoUser
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
namespace FireflyIII\Api\V1\Requests\Data\Bulk;
|
||||||
|
|
||||||
|
use JsonException;
|
||||||
use FireflyIII\Enums\ClauseType;
|
use FireflyIII\Enums\ClauseType;
|
||||||
use FireflyIII\Rules\IsValidBulkClause;
|
use FireflyIII\Rules\IsValidBulkClause;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
@@ -52,7 +53,7 @@ class TransactionRequest extends FormRequest
|
|||||||
$data = [
|
$data = [
|
||||||
'query' => json_decode($this->get('query'), true, 8, JSON_THROW_ON_ERROR),
|
'query' => json_decode($this->get('query'), true, 8, JSON_THROW_ON_ERROR),
|
||||||
];
|
];
|
||||||
} catch (\JsonException $e) {
|
} catch (JsonException $e) {
|
||||||
// dont really care. the validation should catch invalid json.
|
// dont really care. the validation should catch invalid json.
|
||||||
app('log')->error($e->getMessage());
|
app('log')->error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
namespace FireflyIII\Api\V1\Requests\Models\Bill;
|
||||||
|
|
||||||
|
use ValueError;
|
||||||
|
use TypeError;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
use FireflyIII\Rules\IsBoolean;
|
||||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
@@ -109,7 +111,7 @@ class StoreRequest extends FormRequest
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = bccomp($min, $max);
|
$result = bccomp($min, $max);
|
||||||
} catch (\ValueError $e) {
|
} catch (ValueError $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
$validator->errors()->add('amount_min', (string) trans('validation.generic_invalid'));
|
$validator->errors()->add('amount_min', (string) trans('validation.generic_invalid'));
|
||||||
$validator->errors()->add('amount_max', (string) trans('validation.generic_invalid'));
|
$validator->errors()->add('amount_max', (string) trans('validation.generic_invalid'));
|
||||||
@@ -124,7 +126,7 @@ class StoreRequest extends FormRequest
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$failed = $validator->fails();
|
$failed = $validator->fails();
|
||||||
} catch (\TypeError $e) {
|
} catch (TypeError $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
$failed = false;
|
$failed = false;
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\System;
|
namespace FireflyIII\Api\V1\Requests\System;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ class CronRequest extends FormRequest
|
|||||||
$data['date'] = $this->getCarbonDate('date');
|
$data['date'] = $this->getCarbonDate('date');
|
||||||
}
|
}
|
||||||
// catch NULL.
|
// catch NULL.
|
||||||
if (null === $data['date']) {
|
if (!$data['date'] instanceof Carbon) {
|
||||||
$data['date'] = today(config('app.timezone'));
|
$data['date'] = today(config('app.timezone'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -90,7 +90,7 @@ class AccountController extends Controller
|
|||||||
'meta' => [
|
'meta' => [
|
||||||
'type' => $account->accountType->type,
|
'type' => $account->accountType->type,
|
||||||
// TODO is multi currency property.
|
// TODO is multi currency property.
|
||||||
'currency_id' => null === $currency ? null : (string) $currency->id,
|
'currency_id' => $currency instanceof TransactionCurrency ? (string) $currency->id : null,
|
||||||
'currency_code' => $currency?->code,
|
'currency_code' => $currency?->code,
|
||||||
'currency_symbol' => $currency?->symbol,
|
'currency_symbol' => $currency?->symbol,
|
||||||
'currency_decimal_places' => $currency?->decimal_places,
|
'currency_decimal_places' => $currency?->decimal_places,
|
||||||
|
@@ -94,7 +94,7 @@ class AccountController extends Controller
|
|||||||
private function renderAccountData(array $params, Account $account): void
|
private function renderAccountData(array $params, Account $account): void
|
||||||
{
|
{
|
||||||
$currency = $this->repository->getAccountCurrency($account);
|
$currency = $this->repository->getAccountCurrency($account);
|
||||||
if (null === $currency) {
|
if (!$currency instanceof TransactionCurrency) {
|
||||||
$currency = $this->default;
|
$currency = $this->default;
|
||||||
}
|
}
|
||||||
$currentSet = [
|
$currentSet = [
|
||||||
|
@@ -117,7 +117,7 @@ class Controller extends BaseController
|
|||||||
app('log')->warning(sprintf('Ignored invalid date "%s" in API v2 controller parameter check: %s', substr((string) $date, 0, 20), $e->getMessage()));
|
app('log')->warning(sprintf('Ignored invalid date "%s" in API v2 controller parameter check: %s', substr((string) $date, 0, 20), $e->getMessage()));
|
||||||
}
|
}
|
||||||
// out of range? set to null.
|
// out of range? set to null.
|
||||||
if (null !== $obj && ($obj->year <= 1900 || $obj->year > 2099)) {
|
if ($obj instanceof Carbon && ($obj->year <= 1900 || $obj->year > 2099)) {
|
||||||
app('log')->warning(sprintf('Refuse to use date "%s" in API v2 controller parameter check: %s', $field, $obj->toAtomString()));
|
app('log')->warning(sprintf('Refuse to use date "%s" in API v2 controller parameter check: %s', $field, $obj->toAtomString()));
|
||||||
$obj = null;
|
$obj = null;
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V2\Controllers\Summary;
|
namespace FireflyIII\Api\V2\Controllers\Summary;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V2\Controllers\Controller;
|
use FireflyIII\Api\V2\Controllers\Controller;
|
||||||
use FireflyIII\Api\V2\Request\Generic\DateRequest;
|
use FireflyIII\Api\V2\Request\Generic\DateRequest;
|
||||||
@@ -92,7 +93,7 @@ class BasicController extends Controller
|
|||||||
* This endpoint is documented at:
|
* This endpoint is documented at:
|
||||||
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/summary/getBasicSummary
|
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v2)#/summary/getBasicSummary
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*
|
*
|
||||||
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
|
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
|
||||||
*/
|
*/
|
||||||
@@ -398,15 +399,14 @@ class BasicController extends Controller
|
|||||||
*/
|
*/
|
||||||
protected function notInDateRange(Carbon $date, Carbon $start, Carbon $end): bool // Validate a preference
|
protected function notInDateRange(Carbon $date, Carbon $start, Carbon $end): bool // Validate a preference
|
||||||
{
|
{
|
||||||
$result = false;
|
|
||||||
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
||||||
$result = true;
|
return true;
|
||||||
}
|
}
|
||||||
// start and end in the past? use $end
|
// start and end in the past? use $end
|
||||||
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
|
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
|
||||||
$result = true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V2\Controllers\Transaction\List;
|
namespace FireflyIII\Api\V2\Controllers\Transaction\List;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Api\V2\Controllers\Controller;
|
use FireflyIII\Api\V2\Controllers\Controller;
|
||||||
use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest;
|
use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest;
|
||||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||||
@@ -62,11 +63,11 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
$start = $request->getStartDate();
|
$start = $request->getStartDate();
|
||||||
$end = $request->getEndDate();
|
$end = $request->getEndDate();
|
||||||
if (null !== $start) {
|
if ($start instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set start date to %s', $start->toIso8601String()));
|
app('log')->debug(sprintf('Set start date to %s', $start->toIso8601String()));
|
||||||
$collector->setStart($start);
|
$collector->setStart($start);
|
||||||
}
|
}
|
||||||
if (null !== $end) {
|
if ($end instanceof Carbon) {
|
||||||
app('log')->debug(sprintf('Set end date to %s', $start->toIso8601String()));
|
app('log')->debug(sprintf('Set end date to %s', $start->toIso8601String()));
|
||||||
$collector->setEnd($end);
|
$collector->setEnd($end);
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ class InfiniteListRequest extends FormRequest
|
|||||||
|
|
||||||
$start = $this->getStartDate();
|
$start = $this->getStartDate();
|
||||||
$end = $this->getEndDate();
|
$end = $this->getEndDate();
|
||||||
if (null !== $start && null !== $end) {
|
if ($start instanceof Carbon && $end instanceof Carbon) {
|
||||||
$array['start'] = $start->format('Y-m-d');
|
$array['start'] = $start->format('Y-m-d');
|
||||||
$array['end'] = $end->format('Y-m-d');
|
$array['end'] = $end->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ class ListRequest extends FormRequest
|
|||||||
|
|
||||||
$start = $this->getStartDate();
|
$start = $this->getStartDate();
|
||||||
$end = $this->getEndDate();
|
$end = $this->getEndDate();
|
||||||
if (null !== $start && null !== $end) {
|
if ($start instanceof Carbon && $end instanceof Carbon) {
|
||||||
$array['start'] = $start->format('Y-m-d');
|
$array['start'] = $start->format('Y-m-d');
|
||||||
$array['end'] = $end->format('Y-m-d');
|
$array['end'] = $end->format('Y-m-d');
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V2\Request\Model\Transaction;
|
namespace FireflyIII\Api\V2\Request\Model\Transaction;
|
||||||
|
|
||||||
|
use Override;
|
||||||
use FireflyIII\Api\V1\Requests\Models\AvailableBudget\Request;
|
use FireflyIII\Api\V1\Requests\Models\AvailableBudget\Request;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\TransactionGroup;
|
use FireflyIII\Models\TransactionGroup;
|
||||||
@@ -64,7 +65,7 @@ class UpdateRequest extends Request
|
|||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
#[\Override]
|
#[Override]
|
||||||
public function getAll(): array
|
public function getAll(): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||||
@@ -248,7 +249,7 @@ class UpdateRequest extends Request
|
|||||||
/**
|
/**
|
||||||
* The rules that the incoming request must be matched against.
|
* The rules that the incoming request must be matched against.
|
||||||
*/
|
*/
|
||||||
#[\Override]
|
#[Override]
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
app('log')->debug(sprintf('Now in %s', __METHOD__));
|
||||||
@@ -332,7 +333,7 @@ class UpdateRequest extends Request
|
|||||||
/**
|
/**
|
||||||
* Configure the validator instance.
|
* Configure the validator instance.
|
||||||
*/
|
*/
|
||||||
#[\Override]
|
#[Override]
|
||||||
public function withValidator(Validator $validator): void
|
public function withValidator(Validator $validator): void
|
||||||
{
|
{
|
||||||
app('log')->debug('Now in withValidator');
|
app('log')->debug('Now in withValidator');
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V2\Response\Sum;
|
namespace FireflyIII\Api\V2\Response\Sum;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Models\TransactionCurrency;
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@@ -39,7 +40,7 @@ class AutoSum
|
|||||||
/**
|
/**
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function autoSum(Collection $objects, \Closure $getCurrency, \Closure $getSum): array
|
public function autoSum(Collection $objects, Closure $getCurrency, Closure $getSum): array
|
||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ class DebugController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Artisan::call('twig:clean');
|
Artisan::call('twig:clean');
|
||||||
} catch (\Exception $e) { // intentional generic exception
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ class DebugController extends Controller
|
|||||||
$return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt'));
|
$return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt'));
|
||||||
app('log')->debug(sprintf('build is now "%s"', $return['build']));
|
app('log')->debug(sprintf('build is now "%s"', $return['build']));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
app('log')->debug('Could not check build counter, but thats ok.');
|
app('log')->debug('Could not check build counter, but thats ok.');
|
||||||
app('log')->warning($e->getMessage());
|
app('log')->warning($e->getMessage());
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ class DebugController extends Controller
|
|||||||
if (file_exists('/var/www/build-date-main.txt')) {
|
if (file_exists('/var/www/build-date-main.txt')) {
|
||||||
$return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt'));
|
$return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt'));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
app('log')->debug('Could not check build date, but thats ok.');
|
app('log')->debug('Could not check build date, but thats ok.');
|
||||||
app('log')->warning($e->getMessage());
|
app('log')->warning($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Carbon\Exceptions\InvalidFormatException;
|
use Carbon\Exceptions\InvalidFormatException;
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
@@ -57,7 +58,7 @@ class HomeController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Change index date range.
|
* Change index date range.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function dateRange(Request $request): JsonResponse
|
public function dateRange(Request $request): JsonResponse
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Json;
|
namespace FireflyIII\Http\Controllers\Json;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\PiggyBank;
|
use FireflyIII\Models\PiggyBank;
|
||||||
@@ -89,7 +90,7 @@ class FrontpageController extends Controller
|
|||||||
if (0 !== count($info)) {
|
if (0 !== count($info)) {
|
||||||
try {
|
try {
|
||||||
$html = view('json.piggy-banks', compact('info', 'convertToNative', 'native'))->render();
|
$html = view('json.piggy-banks', compact('info', 'convertToNative', 'native'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
app('log')->error(sprintf('Cannot render json.piggy-banks: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$html = 'Could not render view.';
|
$html = 'Could not render view.';
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Json;
|
namespace FireflyIII\Http\Controllers\Json;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -130,7 +131,7 @@ class ReconcileController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render();
|
$view = view('accounts.reconcile.overview', compact('account', 'start', 'diffCompare', 'difference', 'end', 'clearedAmount', 'startBalance', 'endBalance', 'amount', 'route', 'countCleared', 'reconSum', 'selectedIds'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('View error: %s', $e->getMessage()));
|
app('log')->debug(sprintf('View error: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
|
$view = sprintf('Could not render accounts.reconcile.overview: %s', $e->getMessage());
|
||||||
@@ -228,7 +229,7 @@ class ReconcileController extends Controller
|
|||||||
'accounts.reconcile.transactions',
|
'accounts.reconcile.transactions',
|
||||||
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
compact('account', 'journals', 'currency', 'start', 'end', 'selectionStart', 'selectionEnd')
|
||||||
)->render();
|
)->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
|
$html = sprintf('Could not render accounts.reconcile.transactions: %s', $e->getMessage());
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Json;
|
namespace FireflyIII\Http\Controllers\Json;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\JsonResponse;
|
use Illuminate\Http\JsonResponse;
|
||||||
@@ -50,7 +51,7 @@ class RuleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
$view = view('rules.partials.action', compact('actions', 'count'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
app('log')->error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$view = 'Could not render view.';
|
$view = 'Could not render view.';
|
||||||
@@ -80,7 +81,7 @@ class RuleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
app('log')->error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$view = 'Could not render view.';
|
$view = 'Could not render view.';
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use JsonException;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Events\Preferences\UserGroupChangedDefaultCurrency;
|
use FireflyIII\Events\Preferences\UserGroupChangedDefaultCurrency;
|
||||||
@@ -155,7 +156,7 @@ class PreferencesController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$locales = json_decode((string) file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
|
$locales = json_decode((string) file_get_contents(resource_path(sprintf('locales/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
|
||||||
} catch (\JsonException $e) {
|
} catch (JsonException $e) {
|
||||||
app('log')->error($e->getMessage());
|
app('log')->error($e->getMessage());
|
||||||
$locales = [];
|
$locales = [];
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Profile;
|
namespace FireflyIII\Http\Controllers\Profile;
|
||||||
|
|
||||||
|
use Cookie;
|
||||||
|
use Google2FA;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Events\Security\DisabledMFA;
|
use FireflyIII\Events\Security\DisabledMFA;
|
||||||
use FireflyIII\Events\Security\EnabledMFA;
|
use FireflyIII\Events\Security\EnabledMFA;
|
||||||
@@ -182,7 +184,7 @@ class MfaController extends Controller
|
|||||||
|
|
||||||
// also logout current 2FA tokens.
|
// also logout current 2FA tokens.
|
||||||
$cookieName = config('google2fa.cookie_name', 'google2fa_token');
|
$cookieName = config('google2fa.cookie_name', 'google2fa_token');
|
||||||
\Cookie::forget($cookieName);
|
Cookie::forget($cookieName);
|
||||||
|
|
||||||
// send user notification.
|
// send user notification.
|
||||||
Log::channel('audit')->info(sprintf('User "%s" has disabled MFA', $user->email));
|
Log::channel('audit')->info(sprintf('User "%s" has disabled MFA', $user->email));
|
||||||
@@ -215,8 +217,8 @@ class MfaController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$domain = $this->getDomain();
|
$domain = $this->getDomain();
|
||||||
$secret = \Google2FA::generateSecretKey();
|
$secret = Google2FA::generateSecretKey();
|
||||||
$image = \Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret);
|
$image = Google2FA::getQRCodeInline($domain, auth()->user()->email, $secret);
|
||||||
|
|
||||||
app('preferences')->set('temp-mfa-secret', $secret);
|
app('preferences')->set('temp-mfa-secret', $secret);
|
||||||
|
|
||||||
@@ -272,7 +274,7 @@ class MfaController extends Controller
|
|||||||
|
|
||||||
// make sure MFA is logged out.
|
// make sure MFA is logged out.
|
||||||
if ('testing' !== config('app.env')) {
|
if ('testing' !== config('app.env')) {
|
||||||
\Google2FA::logout();
|
Google2FA::logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop all info from session:
|
// drop all info from session:
|
||||||
|
@@ -23,6 +23,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
|
use Hash;
|
||||||
|
use Exception;
|
||||||
use FireflyIII\Events\UserChangedEmail;
|
use FireflyIII\Events\UserChangedEmail;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Exceptions\ValidationException;
|
use FireflyIII\Exceptions\ValidationException;
|
||||||
@@ -203,7 +206,7 @@ class ProfileController extends Controller
|
|||||||
$existing = $repository->findByEmail($newEmail);
|
$existing = $repository->findByEmail($newEmail);
|
||||||
if ($existing instanceof User) {
|
if ($existing instanceof User) {
|
||||||
// force user logout.
|
// force user logout.
|
||||||
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
|
|
||||||
session()->flash('success', (string) trans('firefly.email_changed'));
|
session()->flash('success', (string) trans('firefly.email_changed'));
|
||||||
@@ -217,7 +220,7 @@ class ProfileController extends Controller
|
|||||||
event(new UserChangedEmail($user, $newEmail, $oldEmail));
|
event(new UserChangedEmail($user, $newEmail, $oldEmail));
|
||||||
|
|
||||||
// force user logout.
|
// force user logout.
|
||||||
\Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
Auth::guard()->logout(); // @phpstan-ignore-line (does not recognize function)
|
||||||
$request->session()->invalidate();
|
$request->session()->invalidate();
|
||||||
session()->flash('success', (string) trans('firefly.email_changed'));
|
session()->flash('success', (string) trans('firefly.email_changed'));
|
||||||
|
|
||||||
@@ -310,7 +313,7 @@ class ProfileController extends Controller
|
|||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!\Hash::check($request->get('password'), auth()->user()->password)) {
|
if (!Hash::check($request->get('password'), auth()->user()->password)) {
|
||||||
session()->flash('error', (string) trans('firefly.invalid_password'));
|
session()->flash('error', (string) trans('firefly.invalid_password'));
|
||||||
|
|
||||||
return redirect(route('profile.delete-account'));
|
return redirect(route('profile.delete-account'));
|
||||||
@@ -343,8 +346,8 @@ class ProfileController extends Controller
|
|||||||
'email' => auth()->user()->email,
|
'email' => auth()->user()->email,
|
||||||
'password' => $request->get('password'),
|
'password' => $request->get('password'),
|
||||||
];
|
];
|
||||||
if (\Auth::once($creds)) {
|
if (Auth::once($creds)) {
|
||||||
\Auth::logoutOtherDevices($request->get('password'));
|
Auth::logoutOtherDevices($request->get('password'));
|
||||||
session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));
|
session()->flash('info', (string) trans('firefly.other_sessions_logged_out'));
|
||||||
|
|
||||||
return redirect(route('profile.index'));
|
return redirect(route('profile.index'));
|
||||||
@@ -359,7 +362,7 @@ class ProfileController extends Controller
|
|||||||
*
|
*
|
||||||
* @return Redirector|RedirectResponse
|
* @return Redirector|RedirectResponse
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function regenerate(Request $request)
|
public function regenerate(Request $request)
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -58,7 +59,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.accounts', compact('accountReport'))->render();
|
$result = view('reports.partials.accounts', compact('accountReport'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.accounts: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -140,7 +141,7 @@ class BalanceController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.balance', compact('report'))->render();
|
$result = view('reports.partials.balance', compact('report'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.balance: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||||
@@ -58,7 +59,7 @@ class BillController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.bills', compact('report'))->render();
|
$result = view('reports.partials.bills', compact('report'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budgets: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -176,7 +177,7 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.budget.partials.avg-expenses', compact('result'))->render();
|
$result = view('reports.budget.partials.avg-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
@@ -326,7 +327,7 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
$result = view('reports.partials.budget-period', compact('report', 'periods'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
@@ -377,7 +378,7 @@ class BudgetController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.budget.partials.top-expenses', compact('result'))->render();
|
$result = view('reports.budget.partials.top-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -295,7 +296,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.category.partials.avg-expenses', compact('result'))->render();
|
$result = view('reports.category.partials.avg-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -345,7 +346,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.category.partials.avg-income', compact('result'))->render();
|
$result = view('reports.category.partials.avg-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -527,7 +528,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||||
|
|
||||||
@@ -599,7 +600,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
$result = view('reports.partials.category-period', compact('report', 'periods'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||||
|
|
||||||
@@ -639,7 +640,7 @@ class CategoryController extends Controller
|
|||||||
try {
|
try {
|
||||||
$result = view('reports.partials.categories', compact('report'))->render();
|
$result = view('reports.partials.categories', compact('report'))->render();
|
||||||
$cache->store($result);
|
$cache->store($result);
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||||
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
$result = sprintf('An error prevented Firefly III from rendering: %s. Apologies.', $e->getMessage());
|
||||||
|
|
||||||
@@ -687,7 +688,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.category.partials.top-expenses', compact('result'))->render();
|
$result = view('reports.category.partials.top-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -735,7 +736,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.category.partials.top-income', compact('result'))->render();
|
$result = view('reports.category.partials.top-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -102,7 +103,7 @@ class DoubleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.double.partials.avg-expenses', compact('result'))->render();
|
$result = view('reports.double.partials.avg-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -152,7 +153,7 @@ class DoubleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.double.partials.avg-income', compact('result'))->render();
|
$result = view('reports.double.partials.avg-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -429,7 +430,7 @@ class DoubleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.double.partials.top-expenses', compact('result'))->render();
|
$result = view('reports.double.partials.top-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -477,7 +478,7 @@ class DoubleController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.double.partials.top-income', compact('result'))->render();
|
$result = view('reports.double.partials.top-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -78,7 +79,7 @@ class OperationsController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.income-expense: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
@@ -112,7 +113,7 @@ class OperationsController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
$result = view('reports.partials.income-expenses', compact('report', 'type'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.income-expenses: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
@@ -167,7 +168,7 @@ class OperationsController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.partials.operations', compact('sums'))->render();
|
$result = view('reports.partials.operations', compact('sums'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render reports.partials.operations: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$result = 'Could not render view.';
|
$result = 'Could not render view.';
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Report;
|
namespace FireflyIII\Http\Controllers\Report;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -292,7 +293,7 @@ class TagController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.tag.partials.avg-expenses', compact('result'))->render();
|
$result = view('reports.tag.partials.avg-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -342,7 +343,7 @@ class TagController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.tag.partials.avg-income', compact('result'))->render();
|
$result = view('reports.tag.partials.avg-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -490,7 +491,7 @@ class TagController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.tag.partials.top-expenses', compact('result'))->render();
|
$result = view('reports.tag.partials.top-expenses', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
@@ -538,7 +539,7 @@ class TagController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$result = view('reports.tag.partials.top-income', compact('result'))->render();
|
$result = view('reports.tag.partials.top-income', compact('result'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
app('log')->debug(sprintf('Could not render reports.partials.budget-period: %s', $e->getMessage()));
|
||||||
$result = sprintf('Could not render view: %s', $e->getMessage());
|
$result = sprintf('Could not render view: %s', $e->getMessage());
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Rule;
|
namespace FireflyIII\Http\Controllers\Rule;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\RuleFormRequest;
|
use FireflyIII\Http\Requests\RuleFormRequest;
|
||||||
@@ -177,7 +178,7 @@ class EditController extends Controller
|
|||||||
'triggers' => $triggers,
|
'triggers' => $triggers,
|
||||||
]
|
]
|
||||||
)->render();
|
)->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
|
$message = sprintf('Throwable was thrown in getPreviousTriggers(): %s', $e->getMessage());
|
||||||
app('log')->debug($message);
|
app('log')->debug($message);
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Rule;
|
namespace FireflyIII\Http\Controllers\Rule;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
@@ -174,7 +175,7 @@ class SelectController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
|
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
|
||||||
} catch (\Throwable $exception) {
|
} catch (Throwable $exception) {
|
||||||
app('log')->error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
|
app('log')->error(sprintf('Could not render view in testTriggers(): %s', $exception->getMessage()));
|
||||||
app('log')->error($exception->getTraceAsString());
|
app('log')->error($exception->getTraceAsString());
|
||||||
$view = sprintf('Could not render list.journals-tiny: %s', $exception->getMessage());
|
$view = sprintf('Could not render list.journals-tiny: %s', $exception->getMessage());
|
||||||
@@ -216,7 +217,7 @@ class SelectController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
|
$view = view('list.journals-array-tiny', ['groups' => $collection])->render();
|
||||||
} catch (\Throwable $exception) {
|
} catch (Throwable $exception) {
|
||||||
$message = sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage());
|
$message = sprintf('Could not render view in testTriggersByRule(): %s', $exception->getMessage());
|
||||||
app('log')->error($message);
|
app('log')->error($message);
|
||||||
app('log')->error($exception->getTraceAsString());
|
app('log')->error($exception->getTraceAsString());
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\RuleGroup;
|
namespace FireflyIII\Http\Controllers\RuleGroup;
|
||||||
|
|
||||||
|
use Exception;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
||||||
@@ -64,7 +65,7 @@ class ExecutionController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Execute the given rulegroup on a set of existing transactions.
|
* Execute the given rulegroup on a set of existing transactions.
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function execute(SelectTransactionsRequest $request, RuleGroup $ruleGroup): RedirectResponse
|
public function execute(SelectTransactionsRequest $request, RuleGroup $ruleGroup): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||||
use FireflyIII\Support\Search\SearchInterface;
|
use FireflyIII\Support\Search\SearchInterface;
|
||||||
@@ -118,7 +119,7 @@ class SearchController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render();
|
$html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
app('log')->error(sprintf('Cannot render search.search: %s', $e->getMessage()));
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
$html = 'Could not render view.';
|
$html = 'Could not render view.';
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\System;
|
namespace FireflyIII\Http\Controllers\System;
|
||||||
|
|
||||||
|
use Artisan;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Exception;
|
use Exception;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
@@ -142,14 +143,14 @@ class InstallController extends Controller
|
|||||||
$this->keys();
|
$this->keys();
|
||||||
}
|
}
|
||||||
if ('generate-keys' !== $command) {
|
if ('generate-keys' !== $command) {
|
||||||
\Artisan::call($command, $args);
|
Artisan::call($command, $args);
|
||||||
app('log')->debug(\Artisan::output());
|
app('log')->debug(Artisan::output());
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) { // intentional generic exception
|
} catch (Exception $e) { // intentional generic exception
|
||||||
throw new FireflyException($e->getMessage(), 0, $e);
|
throw new FireflyException($e->getMessage(), 0, $e);
|
||||||
}
|
}
|
||||||
// clear cache as well.
|
// clear cache as well.
|
||||||
\Cache::clear();
|
Cache::clear();
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -82,7 +82,7 @@ class ConvertController extends Controller
|
|||||||
*
|
*
|
||||||
* @return Factory|Redirector|RedirectResponse|View
|
* @return Factory|Redirector|RedirectResponse|View
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function index(TransactionType $destinationType, TransactionGroup $group)
|
public function index(TransactionType $destinationType, TransactionGroup $group)
|
||||||
{
|
{
|
||||||
@@ -214,7 +214,7 @@ class ConvertController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getLiabilities(): array
|
private function getLiabilities(): array
|
||||||
{
|
{
|
||||||
@@ -238,7 +238,7 @@ class ConvertController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getAssetAccounts(): array
|
private function getAssetAccounts(): array
|
||||||
{
|
{
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers\Transaction;
|
namespace FireflyIII\Http\Controllers\Transaction;
|
||||||
|
|
||||||
|
use InvalidArgumentException;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Enums\AccountTypeEnum;
|
use FireflyIII\Enums\AccountTypeEnum;
|
||||||
use FireflyIII\Enums\TransactionTypeEnum;
|
use FireflyIII\Enums\TransactionTypeEnum;
|
||||||
@@ -231,7 +232,7 @@ class MassController extends Controller
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$carbon = Carbon::parse($value[$journalId]);
|
$carbon = Carbon::parse($value[$journalId]);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
Log::warning(sprintf('Could not parse "%s" but dont mind', $value[$journalId]));
|
Log::warning(sprintf('Could not parse "%s" but dont mind', $value[$journalId]));
|
||||||
Log::warning($e->getMessage());
|
Log::warning($e->getMessage());
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
@@ -56,7 +57,7 @@ class Authenticate
|
|||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
* @throws AuthenticationException
|
* @throws AuthenticationException
|
||||||
*/
|
*/
|
||||||
public function handle($request, \Closure $next, ...$guards)
|
public function handle($request, Closure $next, ...$guards)
|
||||||
{
|
{
|
||||||
$this->authenticate($request, $guards);
|
$this->authenticate($request, $guards);
|
||||||
|
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Support\Domain;
|
use FireflyIII\Support\Domain;
|
||||||
use Illuminate\Contracts\Auth\Factory as Auth;
|
use Illuminate\Contracts\Auth\Factory as Auth;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -63,7 +64,7 @@ class Binder
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
foreach ($request->route()->parameters() as $key => $value) {
|
foreach ($request->route()->parameters() as $key => $value) {
|
||||||
if (array_key_exists($key, $this->binders)) {
|
if (array_key_exists($key, $this->binders)) {
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Support\System\GeneratesInstallationId;
|
use FireflyIII\Support\System\GeneratesInstallationId;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ class InstallationId
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
$this->generateInstallationId();
|
$this->generateInstallationId();
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
use FireflyIII\Support\System\OAuthKeys;
|
use FireflyIII\Support\System\OAuthKeys;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
@@ -45,7 +46,7 @@ class Installer
|
|||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function handle($request, \Closure $next)
|
public function handle($request, Closure $next)
|
||||||
{
|
{
|
||||||
// Log::debug(sprintf('Installer middleware for URL %s', $request->url()));
|
// Log::debug(sprintf('Installer middleware for URL %s', $request->url()));
|
||||||
// ignore installer in test environment.
|
// ignore installer in test environment.
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Models\Account;
|
use FireflyIII\Models\Account;
|
||||||
use FireflyIII\Models\Bill;
|
use FireflyIII\Models\Bill;
|
||||||
use FireflyIII\Models\GroupMembership;
|
use FireflyIII\Models\GroupMembership;
|
||||||
@@ -45,7 +46,7 @@ class InterestingMessage
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if ($this->testing()) {
|
if ($this->testing()) {
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -40,7 +41,7 @@ class IsAdmin
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next, $guard = null)
|
public function handle(Request $request, Closure $next, $guard = null)
|
||||||
{
|
{
|
||||||
if (Auth::guard($guard)->guest()) {
|
if (Auth::guard($guard)->guest()) {
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@@ -37,7 +38,7 @@ class IsDemoUser
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
@@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use App;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||||
use FireflyIII\Support\Facades\Amount;
|
use FireflyIII\Support\Facades\Amount;
|
||||||
@@ -42,7 +44,7 @@ class Range
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
if (null !== $request->user()) {
|
if (null !== $request->user()) {
|
||||||
// set start, end and finish:
|
// set start, end and finish:
|
||||||
@@ -101,7 +103,7 @@ class Range
|
|||||||
// get locale preference:
|
// get locale preference:
|
||||||
$language = app('steam')->getLanguage();
|
$language = app('steam')->getLanguage();
|
||||||
$locale = app('steam')->getLocale();
|
$locale = app('steam')->getLocale();
|
||||||
\App::setLocale($language);
|
App::setLocale($language);
|
||||||
Carbon::setLocale(substr((string) $locale, 0, 2));
|
Carbon::setLocale(substr((string) $locale, 0, 2));
|
||||||
|
|
||||||
$localeArray = app('steam')->getLocaleArray($locale);
|
$localeArray = app('steam')->getLocaleArray($locale);
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ class RedirectIfAuthenticated
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle($request, \Closure $next, $guard = null)
|
public function handle($request, Closure $next, $guard = null)
|
||||||
{
|
{
|
||||||
if (Auth::guard($guard)->check()) {
|
if (Auth::guard($guard)->check()) {
|
||||||
return response()->redirectTo(route('index'));
|
return response()->redirectTo(route('index'));
|
||||||
|
@@ -24,6 +24,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Exception;
|
||||||
use Barryvdh\Debugbar\Facades\Debugbar;
|
use Barryvdh\Debugbar\Facades\Debugbar;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Vite;
|
use Illuminate\Support\Facades\Vite;
|
||||||
@@ -38,9 +40,9 @@ class SecureHeaders
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, \Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
// generate and share nonce.
|
// generate and share nonce.
|
||||||
$nonce = base64_encode(random_bytes(16));
|
$nonce = base64_encode(random_bytes(16));
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Override;
|
||||||
use Illuminate\Contracts\Session\Session;
|
use Illuminate\Contracts\Session\Session;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Session\Middleware\StartSession;
|
use Illuminate\Session\Middleware\StartSession;
|
||||||
@@ -37,7 +38,7 @@ class StartFireflySession extends StartSession
|
|||||||
*
|
*
|
||||||
* @param Session $session
|
* @param Session $session
|
||||||
*/
|
*/
|
||||||
#[\Override]
|
#[Override]
|
||||||
protected function storeCurrentUrl(Request $request, $session): void
|
protected function storeCurrentUrl(Request $request, $session): void
|
||||||
{
|
{
|
||||||
$url = $request->fullUrl();
|
$url = $request->fullUrl();
|
||||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Middleware;
|
namespace FireflyIII\Http\Middleware;
|
||||||
|
|
||||||
|
use Override;
|
||||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
class TrustHosts extends Middleware
|
class TrustHosts extends Middleware
|
||||||
@@ -33,7 +34,7 @@ class TrustHosts extends Middleware
|
|||||||
*
|
*
|
||||||
* @return array<int, null|string>
|
* @return array<int, null|string>
|
||||||
*/
|
*/
|
||||||
#[\Override]
|
#[Override]
|
||||||
public function hosts(): array
|
public function hosts(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
@@ -149,7 +149,7 @@ class ReportFormRequest extends FormRequest
|
|||||||
if (false !== $result && 0 !== $result) {
|
if (false !== $result && 0 !== $result) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[1]);
|
$date = new Carbon($parts[1]);
|
||||||
} catch (\Exception $e) { // intentional generic exception
|
} catch (Exception $e) { // intentional generic exception
|
||||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||||
app('log')->error($error);
|
app('log')->error($error);
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
@@ -187,7 +187,7 @@ class ReportFormRequest extends FormRequest
|
|||||||
if (false !== $result && 0 !== $result) {
|
if (false !== $result && 0 !== $result) {
|
||||||
try {
|
try {
|
||||||
$date = new Carbon($parts[0]);
|
$date = new Carbon($parts[0]);
|
||||||
} catch (\Exception $e) { // intentional generic exception
|
} catch (Exception $e) { // intentional generic exception
|
||||||
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
$error = sprintf('"%s" is not a valid date range: %s', $range, $e->getMessage());
|
||||||
app('log')->error($error);
|
app('log')->error($error);
|
||||||
app('log')->error($e->getTraceAsString());
|
app('log')->error($e->getTraceAsString());
|
||||||
|
@@ -32,7 +32,7 @@ return [
|
|||||||
'table' => 'sessions',
|
'table' => 'sessions',
|
||||||
'store' => null,
|
'store' => null,
|
||||||
'lottery' => [2, 100],
|
'lottery' => [2, 100],
|
||||||
'cookie' => 'firefly_session',
|
'cookie' => env('COOKIE_NAME','firefly_iii_session'),
|
||||||
'path' => env('COOKIE_PATH', '/'),
|
'path' => env('COOKIE_PATH', '/'),
|
||||||
'domain' => env('COOKIE_DOMAIN', null),
|
'domain' => env('COOKIE_DOMAIN', null),
|
||||||
'secure' => env('COOKIE_SECURE', null),
|
'secure' => env('COOKIE_SECURE', null),
|
||||||
|
Reference in New Issue
Block a user