More things [skip ci]

This commit is contained in:
James Cole 2016-04-03 10:51:37 +02:00
parent bb82b0eb79
commit 23cc7be231
4 changed files with 42 additions and 4 deletions

View File

@ -13,7 +13,6 @@ namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
use Log;
use Preferences;
/**
@ -40,7 +39,7 @@ class UserController extends Controller
// add meta stuff.
$users->each(
function (User $user) use ($confirmAccount) {
// user must be logged in, then continue:
// is user activated?
$isConfirmed = Preferences::getForUser($user, 'user_confirmed', false)->data;
if ($isConfirmed === false && $confirmAccount === true) {
$user->activated = false;
@ -48,6 +47,17 @@ class UserController extends Controller
$user->activated = true;
}
// is user admin?
$user->isAdmin = $user->hasRole('owner');
// user has 2FA enabled?
$is2faEnabled = Preferences::getForUser($user, 'twoFactorAuthEnabled', false)->data;
$has2faSecret = !is_null(Preferences::getForUser($user, 'twoFactorAuthSecret'));
if ($is2faEnabled && $has2faSecret) {
$user->has2FA = true;
} else {
$user->has2FA = false;
}
}
);

View File

@ -746,4 +746,5 @@ return [
'administration' => 'Administration',
'user_administration' => 'User administration',
'list_all_users' => 'All users',
'all_users' => 'All users',
];

View File

@ -39,4 +39,11 @@ return [
'completed' => 'Completed',
'iban' => 'IBAN',
'paid_current_period' => 'Paid this period',
'email' => 'Email',
'registered_at' => 'Registered at',
'is_activated' => 'Is activated',
'is_blocked' => 'Is blocked',
'is_admin' => 'Is admin',
'has_two_factor' => 'Has 2FA',
'blocked_code' => 'Block code',
];

View File

@ -14,20 +14,40 @@
<table class="table table-condensed table-sortable">
<thead>
<tr>
<th colspan="2">&nbsp;</th>
<th>{{ trans('list.email') }}</th>
<th>{{ trans('list.registered_at') }}</th>
<th>{{ trans('list.is_admin') }}</th>
<th>{{ trans('list.has_two_factor') }}</th>
<th>{{ trans('list.is_activated') }}</th>
<th>{{ trans('list.is_blocked') }}</th>
<th>{{ trans('list.blocked_code') }}</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>~</td>
<td>#{{ user.id }}</td>
<td>{{ user.email }}</td>
<td>
{{ user.created_at.formatLocalized(monthAndDayFormat) }}
{{ user.created_at.format('H:i') }}
</td>
<td>
{% if user.isAdmin %}
<small class="text-success"><i class="fa fa-fw fa-check"></i></small>
{% else %}
<small class="text-danger"><i class="fa fa-fw fa-times"></i></small>
{% endif %}
</td>
<td>
{% if user.has2FA %}
<small class="text-success"><i class="fa fa-fw fa-check"></i></small>
{% else %}
<small class="text-danger"><i class="fa fa-fw fa-times"></i></small>
{% endif %}
</td>
<td>
{% if user.activated %}
<small class="text-success"><i class="fa fa-fw fa-check"></i></small>
@ -37,9 +57,9 @@
</td>
<td>
{% if user.blocked == 1 %}
<small class="text-danger"><i class="fa fa-fw fa-user-times" alt="Yes"></i></small>
<small class="text-danger"><i class="fa fa-fw fa-check" title="{{ 'yes'|_ }}"></i></small>
{% else %}
<small class="text-success"><i class="fa fa-fw fa-smile-o" alt="No"></i></small>
<small class="text-success"><i class="fa fa-fw fa-times" title="{{ 'no'|_ }}"></i></small>
{% endif %}
</td>
<td>