From 2b16d73e65ad3d0b14bb9d979b9bd05666f7c965 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 21 Sep 2020 20:40:47 +0200 Subject: [PATCH 01/12] Remove LDAP limit from 2FA --- app/Http/Controllers/Auth/TwoFactorController.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index c92049e828..9171feff5f 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -36,21 +36,6 @@ use Preferences; */ class TwoFactorController extends Controller { - /** - * Create a new controller instance. - */ - public function __construct() - { - parent::__construct(); - - $loginProvider = config('firefly.login_provider'); - $authGuard = config('firefly.authentication_guard'); - - if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { - throw new FireflyException('Using external identity provider. Cannot continue.'); - } - } - /** * What to do if 2FA lost? * From 198a0f7011805c7f690925fd191f4f10753a20c5 Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Mon, 21 Sep 2020 21:21:32 +0200 Subject: [PATCH 02/12] Delete manifest.json --- public/manifest.json | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 public/manifest.json diff --git a/public/manifest.json b/public/manifest.json deleted file mode 100644 index e99614ce90..0000000000 --- a/public/manifest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Firefly III", - "short_name": "Firefly III", - "icons": [ - { - "src": "\/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image\/png", - "density": 4 - }, - { - "src": "\/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image\/png" - } - ], - "display": "standalone", - "start_url": "/", - "orientation": "portrait" -} From 855fe1235ac5ea13754cd89feb66401d8f9b9570 Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Mon, 21 Sep 2020 21:24:03 +0200 Subject: [PATCH 03/12] Rename site.webmanifest to manifest.webmanifest As per Web App Manifest spec - https://www.w3.org/TR/appmanifest/ --- public/{site.webmanifest => manifest.webmanifest} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename public/{site.webmanifest => manifest.webmanifest} (100%) diff --git a/public/site.webmanifest b/public/manifest.webmanifest similarity index 100% rename from public/site.webmanifest rename to public/manifest.webmanifest From 86cd3c0c3894afb3cfa98e94ca09f6e68b8472c3 Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Mon, 21 Sep 2020 21:24:32 +0200 Subject: [PATCH 04/12] Do not force portrait mode For easier use on larger devices like tablets --- public/manifest.webmanifest | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest index 4b1fa25232..9da0cb311b 100644 --- a/public/manifest.webmanifest +++ b/public/manifest.webmanifest @@ -15,6 +15,5 @@ ], "theme_color": "#3c8dbc", "background_color": "#3c8dbc", - "display": "standalone", - "orientation": "portrait" + "display": "standalone" } From 14f22009ed74c9532c4efd07facbb92c2c40101a Mon Sep 17 00:00:00 2001 From: Arvind Chembarpu Date: Mon, 21 Sep 2020 21:25:57 +0200 Subject: [PATCH 05/12] Update manifest link --- resources/views/v1/partials/favicons.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/v1/partials/favicons.twig b/resources/views/v1/partials/favicons.twig index c685dd3340..3d7760d7e3 100644 --- a/resources/views/v1/partials/favicons.twig +++ b/resources/views/v1/partials/favicons.twig @@ -1,7 +1,7 @@ - + From d97fd73ce56c3b01103bc8d14231a1d07714d5c7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 22 Sep 2020 16:19:51 +0200 Subject: [PATCH 06/12] Make sure notes always have a value, even when null #3823 --- resources/views/v1/accounts/show.twig | 2 +- resources/views/v1/bills/show.twig | 2 +- resources/views/v1/list/attachments.twig | 2 +- resources/views/v1/piggy-banks/show.twig | 2 +- resources/views/v1/rules/index.twig | 2 +- resources/views/v1/transactions/show.twig | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/views/v1/accounts/show.twig b/resources/views/v1/accounts/show.twig index 9744a83cdf..b4dd5f18a5 100644 --- a/resources/views/v1/accounts/show.twig +++ b/resources/views/v1/accounts/show.twig @@ -122,7 +122,7 @@

{{ 'notes'|_ }}

- {{ account.notes.first.text|markdown }} + {{ account.notes.first.text|default('')|markdown }}
diff --git a/resources/views/v1/bills/show.twig b/resources/views/v1/bills/show.twig index 7efc81111f..594ac11a26 100644 --- a/resources/views/v1/bills/show.twig +++ b/resources/views/v1/bills/show.twig @@ -110,7 +110,7 @@

{{ 'notes'|_ }}

- {{ object.data.notes|markdown }} + {{ object.data.notes|default('')|markdown }}
{% endif %} diff --git a/resources/views/v1/list/attachments.twig b/resources/views/v1/list/attachments.twig index a287e31911..271b9a0371 100644 --- a/resources/views/v1/list/attachments.twig +++ b/resources/views/v1/list/attachments.twig @@ -28,7 +28,7 @@ ({{ attachment.size|filesize }}) {% if null != attachment.notes and '' != attachment.notes %} - {{ attachment.notes|markdown }} + {{ attachment.notes|default('')|markdown }} {% endif %} {% endif %} {% if not attachment.file_exists %} diff --git a/resources/views/v1/piggy-banks/show.twig b/resources/views/v1/piggy-banks/show.twig index 100e99feda..7401539b6e 100644 --- a/resources/views/v1/piggy-banks/show.twig +++ b/resources/views/v1/piggy-banks/show.twig @@ -111,7 +111,7 @@

{{ trans('form.notes') }}

-
{{ piggy.notes|markdown }} +
{{ piggy.notes|default('')|markdown }}
diff --git a/resources/views/v1/rules/index.twig b/resources/views/v1/rules/index.twig index 0bb763b408..0298a2fc89 100644 --- a/resources/views/v1/rules/index.twig +++ b/resources/views/v1/rules/index.twig @@ -115,7 +115,7 @@ {% if not rule.active %} class="text-muted" {% endif %} - >
{{ rule.description|markdown }} + >
{{ rule.description|default('')|markdown }} {% endif %}
{% if rule.strict %}{{ 'rule_is_strict'|_ }}{% else %}{{ 'rule_is_not_strict'|_ }}{% endif %}
diff --git a/resources/views/v1/transactions/show.twig b/resources/views/v1/transactions/show.twig index ffddb9f9a9..70fbf99cd2 100644 --- a/resources/views/v1/transactions/show.twig +++ b/resources/views/v1/transactions/show.twig @@ -311,7 +311,7 @@ {% if null != journal.notes and '' != journal.notes %} {{ trans('list.notes') }} - {{ journal.notes|markdown }} + {{ journal.notes|default('')|markdown }} {% endif %} {% if journalHasMeta(journal.transaction_journal_id, 'recurring_total') and journalHasMeta(journal.transaction_journal_id, 'recurring_count') %} From 18c24a7251302f392e6760ec60b6ebdccd3d78ba Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 22 Sep 2020 18:27:21 +0200 Subject: [PATCH 07/12] Fix #3827 --- resources/views/v1/auth/login.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/v1/auth/login.twig b/resources/views/v1/auth/login.twig index 2d7cedf4af..4b03b96a7f 100644 --- a/resources/views/v1/auth/login.twig +++ b/resources/views/v1/auth/login.twig @@ -63,14 +63,14 @@
-
+
-
+
From f564ef5195a2020b591d643da5e44ac6e1553c10 Mon Sep 17 00:00:00 2001 From: Oliver Kaufmann Date: Tue, 22 Sep 2020 23:47:32 +0200 Subject: [PATCH 08/12] fix notes filter query --- app/Helpers/Collector/Extensions/MetaCollection.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index 176787f3b2..132a906604 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -69,7 +69,7 @@ trait MetaCollection public function notesContain(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%%%s%%', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%%%s%%', $value)); return $this; } @@ -80,7 +80,7 @@ trait MetaCollection public function notesEndWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%%%s', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%%%s', $value)); return $this; } @@ -90,7 +90,7 @@ trait MetaCollection public function withoutNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->whereNull('notes'); + $this->query->whereNull('notes.text'); return $this; } @@ -101,7 +101,7 @@ trait MetaCollection public function withAnyNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->whereNotNull('notes'); + $this->query->whereNotNull('notes.text'); return $this; } @@ -112,7 +112,7 @@ trait MetaCollection public function notesExactly(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', '=', sprintf('%s', $value)); + $this->query->where('notes.text', '=', sprintf('%s', $value)); return $this; } @@ -123,7 +123,7 @@ trait MetaCollection public function notesStartWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where('notes', 'LIKE', sprintf('%s%%', $value)); + $this->query->where('notes.text', 'LIKE', sprintf('%s%%', $value)); return $this; } From 8a2d5b12c3cbf18e7aceb5494aff2d272a3c6959 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 05:56:49 +0200 Subject: [PATCH 09/12] Instructions for one-time donations. --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index e0110103e9..8d3adcb333 100644 --- a/readme.md +++ b/readme.md @@ -137,7 +137,7 @@ OK that was a joke. You can donate using [PayPal](https://www.paypal.com/cgi-bin I'm also very proud to be a part of the **[GitHub Sponsors Program](https://github.com/sponsors/JC5)**. -Thank you for considering donating to Firefly III! +Thank you for considering donating to Firefly III! And remember, if you wish to make a one-time donation just cancel your patronage after the first withdrawal. ## License From b288d6b0ebff3564dda5e6a12639ccaaf0acb6ac Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 06:18:43 +0200 Subject: [PATCH 10/12] Fix #3828 --- app/Http/Controllers/Admin/UserController.php | 34 ++++++++++++++----- resources/views/v1/admin/users/edit.twig | 12 +++++-- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 941b94ecdc..f92aa387cf 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; +use FireflyIII\Api\V1\Requests\UserUpdateRequest; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Requests\UserFormRequest; @@ -36,8 +37,8 @@ use Log; */ class UserController extends Controller { - /** @var UserRepositoryInterface */ - private $repository; + private UserRepositoryInterface $repository; + protected bool $externalIdentity; /** * UserController constructor. @@ -56,17 +57,23 @@ class UserController extends Controller } ); $this->middleware(IsDemoUser::class)->except(['index', 'show']); + $loginProvider = config('firefly.login_provider'); + $authGuard = config('firefly.authentication_guard'); + $this->externalIdentity = 'eloquent' !== $loginProvider || 'web' !== $authGuard; } /** - * Delete a user. - * * @param User $user - * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|RedirectResponse|Redirector|\Illuminate\View\View */ public function delete(User $user) { + if ($this->externalIdentity) { + request()->session()->flash('error', trans('firefly.external_user_mgt_disabled')); + + return redirect(route('admin.users')); + } + $subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]); return view('admin.users.delete', compact('user', 'subTitle')); @@ -81,6 +88,11 @@ class UserController extends Controller */ public function destroy(User $user) { + if ($this->externalIdentity) { + request()->session()->flash('error', trans('firefly.external_user_mgt_disabled')); + + return redirect(route('admin.users')); + } $this->repository->destroy($user); session()->flash('success', (string) trans('firefly.user_deleted')); @@ -96,6 +108,10 @@ class UserController extends Controller */ public function edit(User $user) { + $canEditDetails = true; + if ($this->externalIdentity) { + $canEditDetails = false; + } // put previous url in session if not redirect from store (not "return_to_edit"). if (true !== session('users.edit.fromUpdate')) { $this->rememberPreviousUri('users.edit.uri'); @@ -113,7 +129,7 @@ class UserController extends Controller 'email_changed' => (string) trans('firefly.block_code_email_changed'), ]; - return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes', 'currentUser','isAdmin')); + return view('admin.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin')); } /** @@ -179,8 +195,10 @@ class UserController extends Controller Log::debug('Actually here'); $data = $request->getUserData(); + var_dump($data); + // update password - if ('' !== $data['password']) { + if (array_key_exists('password', $data) && '' !== $data['password']) { $this->repository->changePassword($user, $data['password']); } if (true === $data['is_owner']) { diff --git a/resources/views/v1/admin/users/edit.twig b/resources/views/v1/admin/users/edit.twig index 6f457bd3e8..d1a71fcfa8 100644 --- a/resources/views/v1/admin/users/edit.twig +++ b/resources/views/v1/admin/users/edit.twig @@ -17,9 +17,15 @@

{{ 'mandatoryFields'|_ }}

- {{ ExpandedForm.text('email',null,{'helpText': trans('firefly.admin_update_email')}) }} - {{ ExpandedForm.password('password') }} - {{ ExpandedForm.password('password_confirmation') }} + {% if canEditDetails %} + {{ ExpandedForm.text('email',null,{'helpText': trans('firefly.admin_update_email')}) }} + {{ ExpandedForm.password('password') }} + {{ ExpandedForm.password('password_confirmation') }} + {% else %} + + + + {% endif %} {{ ExpandedForm.checkbox('blocked') }} {{ ExpandedForm.select('blocked_code', codes, user.blocked_code) }} {% if user.id != currentUser.id %} From 29b8cf936e8b3c489e58a52c9b93e4957c54f78c Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 06:18:49 +0200 Subject: [PATCH 11/12] Add mergify config --- .github/.mergify.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/.mergify.yml diff --git a/.github/.mergify.yml b/.github/.mergify.yml new file mode 100644 index 0000000000..03cfa897cd --- /dev/null +++ b/.github/.mergify.yml @@ -0,0 +1,7 @@ +pull_request_rules: + - name: PR on main is never approved. + conditions: + - base=main + actions: + close: + message: Please reopen this PR on the `develop` branch. Thank you. From 0b8b9cb2800d5e20898a6196b56bcea7896e390b Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 23 Sep 2020 06:18:59 +0200 Subject: [PATCH 12/12] Update version. --- config/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/firefly.php b/config/firefly.php index b48a0a8f13..6d25098bd3 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -95,7 +95,7 @@ return [ ], //'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'), - 'version' => '5.4.1', + 'version' => '5.4.2', 'api_version' => '1.4.0', 'db_version' => 15, 'maxUploadSize' => 1073741824, // 1 GB