diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php
index 25f5ae5a87..d02a2717c0 100644
--- a/pandora_console/godmode/users/configure_user.php
+++ b/pandora_console/godmode/users/configure_user.php
@@ -29,7 +29,7 @@
// Load global vars.
global $config;
-hd($_REQUEST, true);
+
check_login();
require_once $config['homedir'].'/vendor/autoload.php';
@@ -773,7 +773,6 @@ if ($update_user) {
);
}
- hd('res1-res2', true);
ui_print_result_message(
$res1 || $res2,
__('User info successfully updated'),
@@ -847,7 +846,7 @@ if ($update_user) {
false,
$info
);
- hd('apitoken', true);
+
ui_print_result_message(
$res1,
($apiTokenRenewed === true) ? __('You have generated a new API Token.') : __('User info successfully updated'),
@@ -916,15 +915,7 @@ if ($add_profile && empty($json_profile)) {
false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
);
- /*
- hd('>>>>>', true);
- hd($id2, true);
- hd($profile2, true);
- hd($group2, true);
- hd($tags, true);
- hd($no_hierarchy, true);
- hd('<<<<<<', true);
- */
+
$return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
if ($return === false) {
$is_err = true;
@@ -1020,48 +1011,49 @@ if (!$new_user) {
$user_id .= ''.$id.'';
$user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '';
- $user_id .= '
'.__('API Token').'
';
- $user_id .= html_print_anchor(
+
+ $apiTokenContentElements[] = '
'.__('API Token').'';
+ $apiTokenContentElements[] = html_print_button(
+ __('Renew'),
+ 'renew_api_token',
+ false,
+ sprintf(
+ 'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')',
+ __('Warning'),
+ __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
+ 'user_profile_form',
+ ),
[
- 'onClick' => sprintf(
- 'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')',
- __('Warning'),
- __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
- 'user_profile_form',
- ),
- 'content' => html_print_image(
- 'images/icono-refrescar.png',
- true,
- [
- 'class' => 'renew_api_token_image clickable',
- 'title' => __('Renew API Token'),
- ]
- ),
- 'class' => 'renew_api_token_link',
+ 'mode' => 'link',
+ 'style' => 'min-width: initial;',
+ ],
+ true,
+ );
+ $apiTokenContentElements[] = html_print_button(
+ __('Show'),
+ 'show_api_token',
+ false,
+ sprintf(
+ 'javascript:showAPIToken(\'%s\', \'%s\')',
+ __('API Token'),
+ base64_encode(__('Your API Token is:').'
'.users_get_API_token($id).' '.__('Please, avoid share this string with others.')),
+ ),
+ [
+ 'mode' => 'link',
+ 'style' => 'min-width: initial;',
+ ],
+ true,
+ );
+
+ $apiTokenContent = html_print_div(
+ [
+ 'class' => 'flex-row-center',
+ 'content' => implode('', $apiTokenContentElements),
],
true
);
- $user_id .= html_print_anchor(
- [
- 'onClick' => sprintf(
- 'javascript:showAPIToken(\'%s\', \'%s\')',
- __('API Token'),
- base64_encode(__('Your API Token is:').'
'.users_get_API_token($id).' '.__('Please, avoid share this string with others.')),
- ),
- 'content' => html_print_image(
- 'images/eye_show.png',
- true,
- [
- 'class' => 'renew_api_token_image clickable',
- 'title' => __('Show API Token'),
- ]
- ),
- 'class' => 'renew_api_token_link',
- ],
- true
- );
- $user_id .= '
';
+ $user_id .= $apiTokenContent;
} else {
$user_id = ''.html_print_input_text_extended(
'id_user',
@@ -1585,7 +1577,12 @@ if ($double_auth_enabled === true && (bool) $config['double_auth_enabled'] === t
);
}
-$doubleAuthentication = html_print_div(['content' => implode('', $doubleAuthElementsContent)], true);
+if (empty($doubleAuthElementsContent) === false) {
+ $doubleAuthentication = html_print_div(['content' => implode('', $doubleAuthElementsContent)], true);
+} else {
+ $doubleAuthentication = '';
+}
+
/*
if (isset($double_authentication)) {
diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php
index c7e4ab43ee..09bddade26 100644
--- a/pandora_console/godmode/users/user_management.php
+++ b/pandora_console/godmode/users/user_management.php
@@ -220,9 +220,14 @@ $userManagementTable->data['fields_phone'][0] = html_print_input_text_extended(
true
);
+$fieldsAdminUserCount = 0;
$userManagementTable->rowclass['captions_fields_admin_user'] = 'field_half_width w50p';
-$userManagementTable->cellclass['captions_fields_admin_user'][0] = 'wrap';
-$userManagementTable->data['captions_fields_admin_user'][0] = $doubleAuthentication;
+$userManagementTable->cellclass['captions_fields_admin_user'][$fieldsAdminUserCount] = 'wrap';
+if (empty($doubleAuthentication) === false) {
+ $userManagementTable->data['captions_fields_admin_user'][$fieldsAdminUserCount] = $doubleAuthentication;
+ $fieldsAdminUserCount++;
+}
+
if (users_is_admin() === true) {
$globalProfileContent = [];
$globalProfileContent[] = ''.__('Administrator user').'';
@@ -233,8 +238,8 @@ if (users_is_admin() === true) {
true
);
- $userManagementTable->cellclass['captions_fields_admin_user'][1] = 'wrap';
- $userManagementTable->data['captions_fields_admin_user'][1] = html_print_div(
+ $userManagementTable->cellclass['captions_fields_admin_user'][$fieldsAdminUserCount] = 'wrap';
+ $userManagementTable->data['captions_fields_admin_user'][$fieldsAdminUserCount] = html_print_div(
[
'class' => 'margin-top-10',
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
@@ -703,6 +708,34 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true
);
+
+$contentQrCode = [];
+$contentQrCode[] = html_print_image(
+ 'images/example_qr.png',
+ true,
+ [
+ 'width' => '200px',
+ 'height' => '200px',
+ ]
+);
+$contentQrCode[] = ''.__('Generated automatically with the information provided for the user').'';
+
+$qrCode = html_print_div(
+ [
+ 'style' => 'display: flex;flex-direction: column;align-items: center;',
+ 'content' => implode('', $contentQrCode),
+ ],
+ true
+);
+
+// QR Code and API Token advice.
+html_print_div(
+ [
+ 'id' => 'api_qrcode_display',
+ 'content' => $qrCode.$apiTokenContent,
+ ]
+);
+
html_print_table($userManagementTable);
// User Profile definition table. (Only where user is not creating).
if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) {
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index 735801616c..d51e83c940 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -3449,7 +3449,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$output = '';
$classes = '';
$fixedId = '';
-
+ $iconStyle = '';
+ $spanStyle = 'margin-top: 4px;';
if (empty($name) === true) {
$name = 'unnamed';
}
@@ -3477,6 +3478,10 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$classes .= ' '.$value;
} else if ($attribute === 'fixed_id') {
$fixedId = $value;
+ } else if ($attribute === 'icon_style') {
+ $iconStyle = $value;
+ } else if ($attribute === 'span_style') {
+ $spanStyle .= $value;
} else if ($attribute === 'rawAttributes') {
$buttonType = ($attr_array['type'] ?? 'button');
$buttonAttributes = $value;
@@ -3492,7 +3497,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
if (empty($iconToUse) === false || (isset($buttonMode) === true && $buttonMode !== 'onlyIcon')) {
$iconDiv = html_print_div(
[
- 'style' => '',
+ 'style' => $iconStyle,
'class' => sprintf(
'subIcon %s %s',
$iconToUse,
@@ -3510,7 +3515,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name);
if ($imageButton === false) {
- $content = ''.$label.'';
+ $content = ''.$label.'';
$content .= $iconDiv;
} else {
$content = $iconDiv;
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 8304d212ac..2166f706b4 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -11174,6 +11174,24 @@ form#satellite_conf_edit > fieldset.full-column {
z-index: 50;
}
+#api_qrcode_display {
+ width: 300px;
+ height: 300px;
+ position: absolute;
+ left: 660px;
+ top: 130px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-around;
+}
+
+.input_sub_placeholder.input_sub_placeholder_qrcode {
+ font-size: 13px;
+ text-align: center;
+ width: 70%;
+}
+
.action-buttons > button {
margin: 10px;
}