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
{
$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;
}

View File

@@ -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']) {

View File

@@ -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?
*

View File

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

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",
"background_color": "#3c8dbc",
"display": "standalone",
"orientation": "portrait"
"display": "standalone"
}

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)**.
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

View File

@@ -17,9 +17,15 @@
<h3 class="box-title">{{ 'mandatoryFields'|_ }}</h3>
</div>
<div class="box-body">
{{ 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 %}
<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.select('blocked_code', codes, user.blocked_code) }}
{% 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') }}"/>
</div>
<div class="row">
<div class="col-xs-8">
<div class="col-xs-6">
<div class="checkbox">
<label>
<input type="checkbox" name="remember" {% if remember %}checked="checked"{% endif %} value="1"> {{ trans('form.remember_me') }}
</label>
</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>
</div>
</div>

View File

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

View File

@@ -28,7 +28,7 @@
</a>
({{ attachment.size|filesize }})
{% if null != attachment.notes and '' != attachment.notes %}
{{ attachment.notes|markdown }}
{{ attachment.notes|default('')|markdown }}
{% endif %}
{% endif %}
{% 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="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="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="shortcut icon" href="favicon.ico?v=3e8AboOwbd">
<meta name="apple-mobile-web-app-title" content="Firefly III">

View File

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

View File

@@ -115,7 +115,7 @@
{% if not rule.active %}
class="text-muted"
{% endif %}
><br/>{{ rule.description|markdown }}</small>
><br/>{{ rule.description|default('')|markdown }}</small>
{% 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>
</td>

View File

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