Merge branch 'develop' into fix-account-detail

This commit is contained in:
James Cole
2020-09-23 07:40:46 +00:00
committed by GitHub
16 changed files with 59 additions and 64 deletions

7
.github/.mergify.yml vendored Normal file
View File

@@ -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.

View File

@@ -69,7 +69,7 @@ trait MetaCollection
public function notesContain(string $value): GroupCollectorInterface public function notesContain(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where('notes', 'LIKE', sprintf('%%%s%%', $value)); $this->query->where('notes.text', 'LIKE', sprintf('%%%s%%', $value));
return $this; return $this;
} }
@@ -80,7 +80,7 @@ trait MetaCollection
public function notesEndWith(string $value): GroupCollectorInterface public function notesEndWith(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where('notes', 'LIKE', sprintf('%%%s', $value)); $this->query->where('notes.text', 'LIKE', sprintf('%%%s', $value));
return $this; return $this;
} }
@@ -90,7 +90,7 @@ trait MetaCollection
public function withoutNotes(): GroupCollectorInterface public function withoutNotes(): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->whereNull('notes'); $this->query->whereNull('notes.text');
return $this; return $this;
} }
@@ -101,7 +101,7 @@ trait MetaCollection
public function withAnyNotes(): GroupCollectorInterface public function withAnyNotes(): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->whereNotNull('notes'); $this->query->whereNotNull('notes.text');
return $this; return $this;
} }
@@ -112,7 +112,7 @@ trait MetaCollection
public function notesExactly(string $value): GroupCollectorInterface public function notesExactly(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where('notes', '=', sprintf('%s', $value)); $this->query->where('notes.text', '=', sprintf('%s', $value));
return $this; return $this;
} }
@@ -123,7 +123,7 @@ trait MetaCollection
public function notesStartWith(string $value): GroupCollectorInterface public function notesStartWith(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where('notes', 'LIKE', sprintf('%s%%', $value)); $this->query->where('notes.text', 'LIKE', sprintf('%s%%', $value));
return $this; return $this;
} }

View File

@@ -22,6 +22,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Admin; namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Api\V1\Requests\UserUpdateRequest;
use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Requests\UserFormRequest; use FireflyIII\Http\Requests\UserFormRequest;
@@ -36,8 +37,8 @@ use Log;
*/ */
class UserController extends Controller class UserController extends Controller
{ {
/** @var UserRepositoryInterface */ private UserRepositoryInterface $repository;
private $repository; protected bool $externalIdentity;
/** /**
* UserController constructor. * UserController constructor.
@@ -56,17 +57,23 @@ class UserController extends Controller
} }
); );
$this->middleware(IsDemoUser::class)->except(['index', 'show']); $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 * @param User $user
* * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|RedirectResponse|Redirector|\Illuminate\View\View
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/ */
public function delete(User $user) 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]); $subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]);
return view('admin.users.delete', compact('user', 'subTitle')); return view('admin.users.delete', compact('user', 'subTitle'));
@@ -81,6 +88,11 @@ class UserController extends Controller
*/ */
public function destroy(User $user) 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); $this->repository->destroy($user);
session()->flash('success', (string) trans('firefly.user_deleted')); session()->flash('success', (string) trans('firefly.user_deleted'));
@@ -96,6 +108,10 @@ class UserController extends Controller
*/ */
public function edit(User $user) 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"). // put previous url in session if not redirect from store (not "return_to_edit").
if (true !== session('users.edit.fromUpdate')) { if (true !== session('users.edit.fromUpdate')) {
$this->rememberPreviousUri('users.edit.uri'); $this->rememberPreviousUri('users.edit.uri');
@@ -113,7 +129,7 @@ class UserController extends Controller
'email_changed' => (string) trans('firefly.block_code_email_changed'), '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'); Log::debug('Actually here');
$data = $request->getUserData(); $data = $request->getUserData();
var_dump($data);
// update password // update password
if ('' !== $data['password']) { if (array_key_exists('password', $data) && '' !== $data['password']) {
$this->repository->changePassword($user, $data['password']); $this->repository->changePassword($user, $data['password']);
} }
if (true === $data['is_owner']) { if (true === $data['is_owner']) {

View File

@@ -36,21 +36,6 @@ use Preferences;
*/ */
class TwoFactorController extends Controller 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? * What to do if 2FA lost?
* *

View File

@@ -95,7 +95,7 @@ return [
], ],
//'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'), //'encryption' => null === env('USE_ENCRYPTION') || true === env('USE_ENCRYPTION'),
'version' => '5.4.1', 'version' => '5.4.2',
'api_version' => '1.4.0', 'api_version' => '1.4.0',
'db_version' => 15, 'db_version' => 15,
'maxUploadSize' => 1073741824, // 1 GB 'maxUploadSize' => 1073741824, // 1 GB

View File

@@ -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"
}

View File

@@ -15,6 +15,5 @@
], ],
"theme_color": "#3c8dbc", "theme_color": "#3c8dbc",
"background_color": "#3c8dbc", "background_color": "#3c8dbc",
"display": "standalone", "display": "standalone"
"orientation": "portrait"
} }

View File

@@ -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)**. 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 ## License

View File

@@ -17,9 +17,15 @@
<h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3> <h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
{{ ExpandedForm.text('email',null,{'helpText': trans('firefly.admin_update_email')}) }} {% if canEditDetails %}
{{ ExpandedForm.password('password') }} {{ ExpandedForm.text('email',null,{'helpText': trans('firefly.admin_update_email')}) }}
{{ ExpandedForm.password('password_confirmation') }} {{ ExpandedForm.password('password') }}
{{ ExpandedForm.password('password_confirmation') }}
{% else %}
<input type="hidden" name="email" value="{{ user.email }}"/>
<input type="hidden" name="password" value=""/>
<input type="hidden" name="password_confirmation" value=""/>
{% endif %}
{{ ExpandedForm.checkbox('blocked') }} {{ ExpandedForm.checkbox('blocked') }}
{{ ExpandedForm.select('blocked_code', codes, user.blocked_code) }} {{ ExpandedForm.select('blocked_code', codes, user.blocked_code) }}
{% if user.id != currentUser.id %} {% if user.id != currentUser.id %}

View File

@@ -63,14 +63,14 @@
<input type="password" name="password" autocomplete="current-password" class="form-control" placeholder="{{ trans('form.password') }}"/> <input type="password" name="password" autocomplete="current-password" class="form-control" placeholder="{{ trans('form.password') }}"/>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-6">
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="remember" {% if remember %}checked="checked"{% endif %} value="1"> {{ trans('form.remember_me') }} <input type="checkbox" name="remember" {% if remember %}checked="checked"{% endif %} value="1"> {{ trans('form.remember_me') }}
</label> </label>
</div> </div>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-6">
<button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'sign_in'|_ }}</button> <button type="submit" class="btn btn-primary btn-block btn-flat">{{ 'sign_in'|_ }}</button>
</div> </div>
</div> </div>

View File

@@ -110,7 +110,7 @@
<h3 class="box-title">{{ 'notes'|_ }}</h3> <h3 class="box-title">{{ 'notes'|_ }}</h3>
</div> </div>
<div class="box-body"> <div class="box-body">
{{ object.data.notes|markdown }} {{ object.data.notes|default('')|markdown }}
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@@ -28,7 +28,7 @@
</a> </a>
({{ attachment.size|filesize }}) ({{ attachment.size|filesize }})
{% if null != attachment.notes and '' != attachment.notes %} {% if null != attachment.notes and '' != attachment.notes %}
{{ attachment.notes|markdown }} {{ attachment.notes|default('')|markdown }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if not attachment.file_exists %} {% if not attachment.file_exists %}

View File

@@ -1,7 +1,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png?v=3e8AboOwbd"> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png?v=3e8AboOwbd">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png?v=3e8AboOwbd"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png?v=3e8AboOwbd">
<link rel="manifest" href="site.webmanifest?v=3e8AboOwbd"> <link rel="manifest" href="manifest.webmanifest?v=3e8AboOwbd">
<link rel="mask-icon" href="safari-pinned-tab.svg" color="#3c8dbc"> <link rel="mask-icon" href="safari-pinned-tab.svg" color="#3c8dbc">
<link rel="shortcut icon" href="favicon.ico?v=3e8AboOwbd"> <link rel="shortcut icon" href="favicon.ico?v=3e8AboOwbd">
<meta name="apple-mobile-web-app-title" content="Firefly III"> <meta name="apple-mobile-web-app-title" content="Firefly III">

View File

@@ -111,7 +111,7 @@
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">{{ trans('form.notes') }}</h3> <h3 class="box-title">{{ trans('form.notes') }}</h3>
</div> </div>
<div class="box-body markdown">{{ piggy.notes|markdown }} <div class="box-body markdown">{{ piggy.notes|default('')|markdown }}
</div> </div>
</div> </div>

View File

@@ -115,7 +115,7 @@
{% if not rule.active %} {% if not rule.active %}
class="text-muted" class="text-muted"
{% endif %} {% endif %}
><br/>{{ rule.description|markdown }}</small> ><br/>{{ rule.description|default('')|markdown }}</small>
{% endif %} {% endif %}
<small><br />{% if rule.strict %}<span class="text-danger">{{ 'rule_is_strict'|_ }}</span>{% else %}<span class="text-success">{{ 'rule_is_not_strict'|_ }}</span>{% endif %}</small> <small><br />{% if rule.strict %}<span class="text-danger">{{ 'rule_is_strict'|_ }}</span>{% else %}<span class="text-success">{{ 'rule_is_not_strict'|_ }}</span>{% endif %}</small>
</td> </td>

View File

@@ -311,7 +311,7 @@
{% if null != journal.notes and '' != journal.notes %} {% if null != journal.notes and '' != journal.notes %}
<tr> <tr>
<td>{{ trans('list.notes') }}</td> <td>{{ trans('list.notes') }}</td>
<td class="markdown">{{ journal.notes|markdown }}</td> <td class="markdown">{{ journal.notes|default('')|markdown }}</td>
</tr> </tr>
{% endif %} {% endif %}
{% if journalHasMeta(journal.transaction_journal_id, 'recurring_total') and journalHasMeta(journal.transaction_journal_id, 'recurring_count') %} {% if journalHasMeta(journal.transaction_journal_id, 'recurring_total') and journalHasMeta(journal.transaction_journal_id, 'recurring_count') %}