add column '2fa status' for customers and admins

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2024-07-20 23:26:53 +02:00
parent 2dae780e0b
commit 4d3cf5da9a
No known key found for this signature in database
GPG Key ID: C121F97338D7A352
7 changed files with 34 additions and 0 deletions

View File

@ -52,6 +52,14 @@ class Text
];
}
public static function type2fa(array $attributes): array
{
return [
'macro' => 'type2fa',
'data' => (int)$attributes['data']
];
}
public static function customerfullname(array $attributes): string
{
return User::getCorrectFullUserDetails($attributes['fields'], true);

View File

@ -110,6 +110,12 @@ return [
'class' => 'text-center',
'callback' => [Text::class, 'boolean'],
],
'type_2fa' => [
'label' => lng('2fa.type_2fa'),
'field' => 'type_2fa',
'class' => 'text-center',
'callback' => [Text::class, 'type2fa'],
],
],
'visible_columns' => Listing::getVisibleColumnsForListing('admin_list', [
'loginname',

View File

@ -149,6 +149,12 @@ return [
'class' => 'text-center',
'callback' => [Text::class, 'boolean'],
],
'c.type_2fa' => [
'label' => lng('2fa.type_2fa'),
'field' => 'type_2fa',
'class' => 'text-center',
'callback' => [Text::class, 'type2fa'],
],
],
'visible_columns' => Listing::getVisibleColumnsForListing('customer_list', [
'c.name',

View File

@ -48,6 +48,7 @@ return [
'2fa_ga_desc' => 'Das Konto ist eingerichtet, um zeitbasierte Einmalpasswörter via Authenticator-App zu erhalten. Um die gewünschte Authenticator-App einzurichten, scanne bitte den untenstehenden QR-Code. Zum Deaktivieren, klicke auf "2FA deaktivieren"',
'2fa_not_activated' => 'Zwei-Faktor Authentifizierung ist nicht aktiviert',
'2fa_not_activated_for_user' => 'Zwei-Faktor Authentifizierung ist für den aktuellen Benutzer nicht aktiviert',
'type_2fa' => '2FA Status',
],
'admin' => [
'overview' => 'Übersicht',

View File

@ -49,6 +49,7 @@ return [
'2fa_ga_desc' => 'Your account is set up to use time-based one-time passwords via authenticator-app. Please scan the QR code below with your desired authenticator app to generate the codes. To deactivate, click on "Deactivate 2FA"',
'2fa_not_activated' => 'Two-factor authentication is not enabled',
'2fa_not_activated_for_user' => 'Two-factor authentication is not enabled for the current user',
'type_2fa' => '2FA status',
],
'admin' => [
'overview' => 'Overview',

View File

@ -29,6 +29,16 @@
{% endif %}
{% endmacro %}
{% macro type2fa(data) %}
{% if (data == 1) %}
<i class="fa-solid fa-envelope text-success"></i>
{% elseif (data == 2) %}
<i class="fa-solid fa-mobile text-success"></i>
{% else %}
<i class="fa-solid fa-lock-open text-warning"></i>
{% endif %}
{% endmacro %}
{% macro link(data) %}
{% apply spaceless %}
<a href="{{ data.href }}" {% if data.class is defined %} class="{{ data.class }}" {% endif %} {% if data.target is defined %} target="{{ data.target }}" {% endif %} {% if data.title is defined %} title="{{ data.title }}" {% endif %}>

View File

@ -47,6 +47,8 @@
{{ macros.domainWithSan(td.data.data) }}
{% elseif td.data.macro == 'actions' %}
{{ macros.actions(td.data.data) }}
{% elseif td.data.macro == 'type2fa' %}
{{ macros.type2fa(td.data.data) }}
{% else %}
Table macro '{{ td.data.macro|json_encode }}' is not implemented!
Unable to handle this data: {{ td.data|json_encode }}