diff --git a/app/Api/V1/Controllers/Data/DestroyController.php b/app/Api/V1/Controllers/Data/DestroyController.php index 61da46dcf1..77ea43e76b 100644 --- a/app/Api/V1/Controllers/Data/DestroyController.php +++ b/app/Api/V1/Controllers/Data/DestroyController.php @@ -183,7 +183,7 @@ class DestroyController extends Controller } if (false === $this->unused) { app('log')->info(sprintf('Deleting account #%d "%s"', $account->id, $account->name)); - Log::channel('audit')->info(sprintf('Deleted account #%d "%s"', $account->id, $account->name)); + Log::channel('audit')->warning(sprintf('Deleted account #%d "%s"', $account->id, $account->name)); $service->destroy($account, null); } } diff --git a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php index b886fb757f..4eb91f9d54 100644 --- a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php @@ -67,7 +67,7 @@ class DestroyController extends Controller public function destroy(Attachment $attachment): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } diff --git a/app/Api/V1/Controllers/Models/Attachment/ShowController.php b/app/Api/V1/Controllers/Models/Attachment/ShowController.php index ad9b89010b..1b792e8101 100644 --- a/app/Api/V1/Controllers/Models/Attachment/ShowController.php +++ b/app/Api/V1/Controllers/Models/Attachment/ShowController.php @@ -76,7 +76,7 @@ class ShowController extends Controller public function download(Attachment $attachment): LaravelResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } @@ -124,7 +124,7 @@ class ShowController extends Controller public function index(): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } @@ -162,7 +162,7 @@ class ShowController extends Controller public function show(Attachment $attachment): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } diff --git a/app/Api/V1/Controllers/Models/Attachment/StoreController.php b/app/Api/V1/Controllers/Models/Attachment/StoreController.php index 16560e5985..aaf8e0a558 100644 --- a/app/Api/V1/Controllers/Models/Attachment/StoreController.php +++ b/app/Api/V1/Controllers/Models/Attachment/StoreController.php @@ -75,7 +75,7 @@ class StoreController extends Controller public function store(StoreRequest $request): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } @@ -99,7 +99,7 @@ class StoreController extends Controller public function upload(Request $request, Attachment $attachment): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } diff --git a/app/Api/V1/Controllers/Models/Attachment/UpdateController.php b/app/Api/V1/Controllers/Models/Attachment/UpdateController.php index 356e6d8fc0..0983ab0e81 100644 --- a/app/Api/V1/Controllers/Models/Attachment/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Attachment/UpdateController.php @@ -70,7 +70,7 @@ class UpdateController extends Controller public function update(UpdateRequest $request, Attachment $attachment): JsonResponse { if(true === auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); + Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__)); throw new NotFoundHttpException(); } diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 59c3f352ec..05e293ba79 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -71,7 +71,7 @@ class AttemptController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); + Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -115,7 +115,7 @@ class AttemptController extends Controller } if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); + Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index 464272eb69..cb5e0d60ee 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -63,7 +63,7 @@ class DestroyController extends Controller public function destroy(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); + Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -93,7 +93,7 @@ class DestroyController extends Controller } if (false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); + Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -121,7 +121,7 @@ class DestroyController extends Controller } if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); + Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index 36d390cf26..78e5a765b8 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -67,7 +67,7 @@ class MessageController extends Controller public function index(Webhook $webhook): JsonResponse { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); + Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } @@ -107,7 +107,7 @@ class MessageController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); + Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php index a08a42e547..100cd1190e 100644 --- a/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php +++ b/app/Api/V1/Requests/Data/Bulk/MoveTransactionsRequest.php @@ -28,6 +28,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -72,6 +73,9 @@ class MoveTransactionsRequest extends FormRequest } } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } private function validateMove(Validator $validator): void diff --git a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php index 0ef3692397..eca11ea6ab 100644 --- a/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php +++ b/app/Api/V1/Requests/Data/Bulk/TransactionRequest.php @@ -30,6 +30,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Validation\Api\Data\Bulk\ValidatesBulkTransactionQuery; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -72,5 +73,8 @@ class TransactionRequest extends FormRequest $this->validateTransactionQuery($validator); } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/AvailableBudget/Request.php b/app/Api/V1/Requests/Models/AvailableBudget/Request.php index 5c653194e4..80b0429b8a 100644 --- a/app/Api/V1/Requests/Models/AvailableBudget/Request.php +++ b/app/Api/V1/Requests/Models/AvailableBudget/Request.php @@ -28,6 +28,7 @@ use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -87,5 +88,8 @@ class Request extends FormRequest } } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/Bill/StoreRequest.php b/app/Api/V1/Requests/Models/Bill/StoreRequest.php index 4c518dde55..a8dd1475ae 100644 --- a/app/Api/V1/Requests/Models/Bill/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Bill/StoreRequest.php @@ -29,6 +29,7 @@ use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -103,5 +104,8 @@ class StoreRequest extends FormRequest } } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php index 99771a6651..e416fac0fb 100644 --- a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php @@ -30,6 +30,7 @@ use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -108,5 +109,8 @@ class UpdateRequest extends FormRequest } } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/Budget/StoreRequest.php b/app/Api/V1/Requests/Models/Budget/StoreRequest.php index aae677e4e2..400465f1ff 100644 --- a/app/Api/V1/Requests/Models/Budget/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Budget/StoreRequest.php @@ -29,6 +29,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -91,5 +92,8 @@ class StoreRequest extends FormRequest $this->validateAutoBudgetAmount($validator); } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php index 77ef888622..26ab16edb0 100644 --- a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php @@ -30,6 +30,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -103,5 +104,8 @@ class UpdateRequest extends FormRequest $this->validateAutoBudgetAmount($validator); } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php index 2795f6fb65..d68879f9ff 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php @@ -28,6 +28,7 @@ use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; +use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; /** @@ -87,5 +88,8 @@ class UpdateRequest extends FormRequest } } ); + if($validator->fails()) { + Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray()); + } } } diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.php index 4c724ee3bb..b1ebda2f53 100644 --- a/app/Http/Controllers/Account/CreateController.php +++ b/app/Http/Controllers/Account/CreateController.php @@ -161,7 +161,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($account, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string) trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index 2ee78464a3..b5bec2472a 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -187,7 +187,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($account, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string) trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 5c68275371..74de205920 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -88,7 +88,7 @@ class LoginController extends Controller // the login attempts for this application. We'll key this by the username and // the IP address of the client making these requests into this application. if ($this->hasTooManyLoginAttempts($request)) { - Log::channel('audit')->info(sprintf('Login for user "%s" was locked out.', $request->get($this->username()))); + Log::channel('audit')->warning(sprintf('Login for user "%s" was locked out.', $request->get($this->username()))); app('log')->error(sprintf('Login for user "%s" was locked out.', $request->get($this->username()))); $this->fireLockoutEvent($request); @@ -114,7 +114,7 @@ class LoginController extends Controller // to login and redirect the user back to the login form. Of course, when this // user surpasses their maximum number of attempts they will get locked out. $this->incrementLoginAttempts($request); - Log::channel('audit')->info(sprintf('Login failed. Attempt for user "%s" failed.', $request->get($this->username()))); + Log::channel('audit')->warning(sprintf('Login failed. Attempt for user "%s" failed.', $request->get($this->username()))); $this->sendFailedLoginResponse($request); diff --git a/app/Http/Controllers/Bill/CreateController.php b/app/Http/Controllers/Bill/CreateController.php index 443d3eb444..f55075856d 100644 --- a/app/Http/Controllers/Bill/CreateController.php +++ b/app/Http/Controllers/Bill/CreateController.php @@ -116,7 +116,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($bill, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Bill/EditController.php b/app/Http/Controllers/Bill/EditController.php index 821d54fde9..abb062e606 100644 --- a/app/Http/Controllers/Bill/EditController.php +++ b/app/Http/Controllers/Bill/EditController.php @@ -128,7 +128,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($bill, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string) trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index 68b3847b62..135305d1bf 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -127,7 +127,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($budget, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index ec0fe37d26..39d9e18120 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -137,7 +137,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($budget, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Category/CreateController.php b/app/Http/Controllers/Category/CreateController.php index e7115c063b..95ef28ab02 100644 --- a/app/Http/Controllers/Category/CreateController.php +++ b/app/Http/Controllers/Category/CreateController.php @@ -100,7 +100,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($category, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Category/EditController.php b/app/Http/Controllers/Category/EditController.php index 265ee53095..734d93ddfb 100644 --- a/app/Http/Controllers/Category/EditController.php +++ b/app/Http/Controllers/Category/EditController.php @@ -104,7 +104,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($category, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/PiggyBank/CreateController.php b/app/Http/Controllers/PiggyBank/CreateController.php index 55d1a8acfe..92aac833d9 100644 --- a/app/Http/Controllers/PiggyBank/CreateController.php +++ b/app/Http/Controllers/PiggyBank/CreateController.php @@ -107,7 +107,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($piggyBank, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.php index 61e729d64c..c0a2de083e 100644 --- a/app/Http/Controllers/PiggyBank/EditController.php +++ b/app/Http/Controllers/PiggyBank/EditController.php @@ -127,7 +127,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($piggyBank, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php index dec86505dd..af0aa56cc1 100644 --- a/app/Http/Controllers/Recurring/CreateController.php +++ b/app/Http/Controllers/Recurring/CreateController.php @@ -243,7 +243,7 @@ class CreateController extends Controller $this->attachments->saveAttachmentsForModel($recurrence, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/Recurring/EditController.php b/app/Http/Controllers/Recurring/EditController.php index 2b67ed8443..7cf6578904 100644 --- a/app/Http/Controllers/Recurring/EditController.php +++ b/app/Http/Controllers/Recurring/EditController.php @@ -181,7 +181,7 @@ class EditController extends Controller $this->attachments->saveAttachmentsForModel($recurrence, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 0b6a39b884..964282de65 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -305,7 +305,7 @@ class TagController extends Controller $this->attachmentsHelper->saveAttachmentsForModel($result, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } @@ -340,7 +340,7 @@ class TagController extends Controller $this->attachmentsHelper->saveAttachmentsForModel($tag, $files); } if (null !== $files && auth()->user()->hasRole('demo')) { - Log::channel('audit')->info(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); + Log::channel('audit')->warning(sprintf('The demo user is trying to upload attachments in %s.', __METHOD__)); session()->flash('info', (string)trans('firefly.no_att_demo_user')); } diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php index ca96f20a5d..75bb2f9cf3 100644 --- a/app/Http/Controllers/TransactionCurrency/CreateController.php +++ b/app/Http/Controllers/TransactionCurrency/CreateController.php @@ -105,7 +105,7 @@ class CreateController extends Controller $data = $request->getCurrencyData(); if (!$this->userRepository->hasRole($user, 'owner')) { app('log')->error('User '.auth()->user()->id.' is not admin, but tried to store a currency.'); - Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data); + Log::channel('audit')->warning('Tried to create (POST) currency without admin rights.', $data); return redirect($this->getPreviousUrl('currencies.create.url'))->withInput(); } @@ -116,7 +116,7 @@ class CreateController extends Controller $currency = $this->repository->store($data); } catch (FireflyException $e) { app('log')->error($e->getMessage()); - Log::channel('audit')->info('Could not store (POST) currency without admin rights.', $data); + Log::channel('audit')->warning('Could not store (POST) currency without admin rights.', $data); $request->session()->flash('error', (string)trans('firefly.could_not_store_currency')); $currency = null; } diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php index ccad32a82e..5ddecbff90 100644 --- a/app/Http/Controllers/TransactionCurrency/DeleteController.php +++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php @@ -74,7 +74,7 @@ class DeleteController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); - Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); + Log::channel('audit')->warning(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); } @@ -83,7 +83,7 @@ class DeleteController extends Controller $location = $this->repository->currencyInUseAt($currency); $message = (string)trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]); $request->session()->flash('error', $message); - Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but currency is in use.', $currency->code)); + Log::channel('audit')->warning(sprintf('Tried to visit page to delete currency %s but currency is in use.', $currency->code)); return redirect(route('currencies.index')); } @@ -107,7 +107,7 @@ class DeleteController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); - Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); + Log::channel('audit')->warning(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); } diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php index 45e3bde766..75ceb9f539 100644 --- a/app/Http/Controllers/TransactionCurrency/EditController.php +++ b/app/Http/Controllers/TransactionCurrency/EditController.php @@ -72,7 +72,7 @@ class EditController extends Controller $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); - Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code)); + Log::channel('audit')->warning(sprintf('Tried to edit currency %s but is not owner.', $currency->code)); return redirect(route('currencies.index')); } @@ -120,7 +120,7 @@ class EditController extends Controller if (!$this->userRepository->hasRole($user, 'owner')) { $request->session()->flash('error', (string)trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); - Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data); + Log::channel('audit')->warning('Tried to update (POST) currency without admin rights.', $data); return redirect(route('currencies.index')); } diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index f1922eb220..f1ae0ffe45 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -60,7 +60,7 @@ class CreateController extends Controller public function index() { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info('User visits webhook create page, but webhooks are DISABLED.'); + Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 9de635f6f5..d701a353e4 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -64,7 +64,7 @@ class DeleteController extends Controller public function index(Webhook $webhook) { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info('User visits webhook delete page, but webhooks are DISABLED.'); + Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index 3173c44327..667738ab64 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -63,7 +63,7 @@ class EditController extends Controller public function index(Webhook $webhook) { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info('User visits webhook edit page, but webhooks are DISABLED.'); + Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index 3ef74dff77..077cd10925 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -56,7 +56,7 @@ class IndexController extends Controller public function index() { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info('User visits webhook index page, but webhooks are DISABLED.'); + Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index db7f6d25fa..2cc4de962f 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -63,7 +63,7 @@ class ShowController extends Controller public function index(Webhook $webhook) { if(false === config('firefly.allow_webhooks')) { - Log::channel('audit')->info(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); + Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); } diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php index 580d4d88f6..58091478c0 100644 --- a/app/Http/Requests/BudgetFormStoreRequest.php +++ b/app/Http/Requests/BudgetFormStoreRequest.php @@ -76,15 +76,15 @@ class BudgetFormStoreRequest extends FormRequest */ public function withValidator(Validator $validator): void { - if($validator->fails()) { - Log::channel('audit')->error('Validation errors for budget', $validator->errors()->toArray()); - } - $validator->after( function (Validator $validator): void { // validate all account info $this->validateAutoBudgetAmount($validator); } ); + + if($validator->fails()) { + Log::channel('audit')->error('Validation errors for budget', $validator->errors()->toArray()); + } } }