diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 69a329c2c9..ac1f2866f0 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -57,20 +57,22 @@ class UserController extends Controller // add meta stuff. $users->each( function (User $user) use ($mustConfirmAccount) { - // is user activated? - $isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data; + $list = ['user_confirmed', 'twoFactorAuthEnabled', 'twoFactorAuthSecret', 'registration_ip_address', 'confirmation_ip_address']; + $preferences = Preferences::getArrayForUser($user, $list); + $user->activated = true; - if ($isConfirmed === false && $mustConfirmAccount === true) { + if (!($preferences['user_confirmed'] === true) && $mustConfirmAccount === true) { $user->activated = false; } $user->isAdmin = $user->hasRole('owner'); - $is2faEnabled = Preferences::getForUser($user, 'twoFactorAuthEnabled', false)->data; - $has2faSecret = !is_null(Preferences::getForUser($user, 'twoFactorAuthSecret')); + $is2faEnabled = $preferences['twoFactorAuthEnabled'] === true; + $has2faSecret = !is_null($preferences['twoFactorAuthSecret']); $user->has2FA = false; if ($is2faEnabled && $has2faSecret) { $user->has2FA = true; } + $user->prefs = $preferences; } ); diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index 55ed08c6dc..44f709de98 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -57,6 +57,30 @@ class Preferences return $this->getForUser(auth()->user(), $name, $default); } + /** + * @param User $user + * @param array $list + * + * @return array + */ + public function getArrayForUser(User $user, array $list): array + { + $result = []; + $preferences = Preference::where('user_id', $user->id)->whereIn('name', $list)->get(['id', 'name', 'data']); + /** @var Preference $preference */ + foreach ($preferences as $preference) { + $result[$preference->name] = $preference->data; + } + foreach ($list as $name) { + if (!isset($result[$name])) { + $result[$name] = null; + } + } + + return $result; + + } + /** * @param \FireflyIII\User $user * @param string $name diff --git a/resources/views/admin/domains/index.twig b/resources/views/admin/domains/index.twig index 5245f5901c..2ea2a88005 100644 --- a/resources/views/admin/domains/index.twig +++ b/resources/views/admin/domains/index.twig @@ -5,19 +5,18 @@ {% endblock %} {% block content %}
- | {{ trans('list.domain') }} | -{{ trans('list.is_blocked') }} | ++ | {{ trans('list.domain') }} | {{ domain }} | -- + | + {{ domain }} + (whois) | {% endfor %} @@ -43,12 +42,9 @@ - - - -
---|
- | {{ trans('list.domain') }} | ++ | {{ trans('list.domain') }} |
---|
- | {{ trans('list.email') }} | -{{ trans('list.registered_at') }} | -{{ trans('list.registered_from') }} | -{{ trans('list.confirmed_from') }} | ++ | {{ trans('list.email') }} | +{{ trans('list.registered_at') }} | +{{ trans('list.registered_from') }} | +{{ trans('list.confirmed_from') }} | {{ trans('list.is_admin') }} | {{ trans('list.has_two_factor') }} | {{ trans('list.is_activated') }} | {{ trans('list.is_blocked') }} | -{{ trans('list.blocked_code') }} | +{{ trans('list.blocked_code') }} | - {{ Preferences.getForUser(user,"registration_ip_address").data }} + | + {{ user.prefs.registration_ip_address }} + {% if user.prefs.registration_ip_address|length > 0 %} + (whois) + {% endif %} | -- {{ Preferences.getForUser(user,"confirmation_ip_address").data }} + | + {{ user.prefs.confirmation_ip_address }} + {% if user.prefs.confirmation_ip_address|length > 0 %} + (whois) + {% endif %} |
{% if user.isAdmin %}
diff --git a/resources/views/list/accounts.twig b/resources/views/list/accounts.twig
index f6dabf7107..995ae450ee 100644
--- a/resources/views/list/accounts.twig
+++ b/resources/views/list/accounts.twig
@@ -2,15 +2,15 @@
{{ trans('list.name') }} |
+ {{ trans('list.name') }} |
{% if what == 'asset' %}
-
+
{% endif %}
-
- {{ trans('list.currentBalance') }} |
+
+ {{ trans('list.currentBalance') }} |
-
-
+
+
|
@@ -42,11 +42,11 @@
{% endif %}
{% if account.lastActivityDate %}
-
{% else %}
-
{% endif %}
diff --git a/resources/views/list/bills.twig b/resources/views/list/bills.twig
index 2443bda422..02ae6daedb 100644
--- a/resources/views/list/bills.twig
+++ b/resources/views/list/bills.twig
@@ -3,13 +3,13 @@
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{ trans('list.name') }} | - -{{ trans('list.matchingAmount') }} | - - + +{{ trans('list.matchingAmount') }} | + + - ++ | {{ 'not_expected_period'|_ }} | - {% endif %} {% if entry.paidDates.count() == 0 and entry.payDates.count() > 0 and entry.active %} -+ | {{ 'not_or_not_yet'|_ }} | - {% endif %} {% if entry.paidDates.count() == entry.payDates.count() and entry.payDates.count() > 0 and entry.active %} -+ |
{% for date in entry.paidDates %}
{{ date.formatLocalized(monthAndDayFormat) }} {% endfor %} |
-
{% endif %}
{% if not entry.active %}
- + | ~ | - {% endif %} diff --git a/resources/views/list/categories.twig b/resources/views/list/categories.twig index 11cda8e04e..16deef6773 100644 --- a/resources/views/list/categories.twig +++ b/resources/views/list/categories.twig @@ -24,11 +24,11 @@ {{ category.name }} {% if category.lastActivity.year != "1900" %} - {% else %} - {% endif %}