Conflict solution

This commit is contained in:
Jonathan 2023-02-16 13:27:11 +01:00
commit ca39b4a4ce
4 changed files with 110 additions and 57 deletions

View File

@ -29,7 +29,7 @@
// Load global vars. // Load global vars.
global $config; global $config;
hd($_REQUEST, true);
check_login(); check_login();
require_once $config['homedir'].'/vendor/autoload.php'; require_once $config['homedir'].'/vendor/autoload.php';
@ -773,7 +773,6 @@ if ($update_user) {
); );
} }
hd('res1-res2', true);
ui_print_result_message( ui_print_result_message(
$res1 || $res2, $res1 || $res2,
__('User info successfully updated'), __('User info successfully updated'),
@ -847,7 +846,7 @@ if ($update_user) {
false, false,
$info $info
); );
hd('apitoken', true);
ui_print_result_message( ui_print_result_message(
$res1, $res1,
($apiTokenRenewed === true) ? __('You have generated a new API Token.') : __('User info successfully updated'), ($apiTokenRenewed === true) ? __('You have generated a new API Token.') : __('User info successfully updated'),
@ -916,15 +915,7 @@ if ($add_profile && empty($json_profile)) {
false, false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags '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); $return = profile_create_user_profile($id2, $profile2, $group2, false, $tags, $no_hierarchy);
if ($return === false) { if ($return === false) {
$is_err = true; $is_err = true;
@ -1020,48 +1011,49 @@ if (!$new_user) {
$user_id .= '<span>'.$id.'</span>'; $user_id .= '<span>'.$id.'</span>';
$user_id .= html_print_input_hidden('id_user', $id, true); $user_id .= html_print_input_hidden('id_user', $id, true);
$user_id .= '</div>'; $user_id .= '</div>';
$user_id .= '<div class="label_select_simple"><p class="edit_user_labels">'.__('API Token').'</p>';
$user_id .= html_print_anchor( $apiTokenContentElements[] = '<span style="height: 15px;font-size: 14px;">'.__('API Token').'</span>';
[ $apiTokenContentElements[] = html_print_button(
'onClick' => sprintf( __('Renew'),
'renew_api_token',
false,
sprintf(
'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')', 'javascript:renewAPIToken(\'%s\', \'%s\', \'%s\')',
__('Warning'), __('Warning'),
__('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'), __('The API token will be renewed. After this action, the last token you were using will not work. Are you sure?'),
'user_profile_form', 'user_profile_form',
), ),
'content' => html_print_image(
'images/icono-refrescar.png',
true,
[ [
'class' => 'renew_api_token_image clickable', 'mode' => 'link',
'title' => __('Renew API Token'), 'style' => 'min-width: initial;',
]
),
'class' => 'renew_api_token_link',
], ],
true true,
); );
$apiTokenContentElements[] = html_print_button(
$user_id .= html_print_anchor( __('Show'),
[ 'show_api_token',
'onClick' => sprintf( false,
sprintf(
'javascript:showAPIToken(\'%s\', \'%s\')', 'javascript:showAPIToken(\'%s\', \'%s\')',
__('API Token'), __('API Token'),
base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')), base64_encode(__('Your API Token is:').'&nbsp;<br><span class="font_12pt bolder">'.users_get_API_token($id).'</span><br>&nbsp;'.__('Please, avoid share this string with others.')),
), ),
'content' => html_print_image(
'images/eye_show.png',
true,
[ [
'class' => 'renew_api_token_image clickable', 'mode' => 'link',
'title' => __('Show API Token'), 'style' => 'min-width: initial;',
] ],
), true,
'class' => 'renew_api_token_link', );
$apiTokenContent = html_print_div(
[
'class' => 'flex-row-center',
'content' => implode('', $apiTokenContentElements),
], ],
true true
); );
$user_id .= '</div>';
$user_id .= $apiTokenContent;
} else { } else {
$user_id = '<div class="label_select_simple">'.html_print_input_text_extended( $user_id = '<div class="label_select_simple">'.html_print_input_text_extended(
'id_user', 'id_user',
@ -1585,7 +1577,12 @@ if ($double_auth_enabled === true && (bool) $config['double_auth_enabled'] === t
); );
} }
if (empty($doubleAuthElementsContent) === false) {
$doubleAuthentication = html_print_div(['content' => implode('', $doubleAuthElementsContent)], true); $doubleAuthentication = html_print_div(['content' => implode('', $doubleAuthElementsContent)], true);
} else {
$doubleAuthentication = '';
}
/* /*
if (isset($double_authentication)) { if (isset($double_authentication)) {

View File

@ -220,9 +220,14 @@ $userManagementTable->data['fields_phone'][0] = html_print_input_text_extended(
true true
); );
$fieldsAdminUserCount = 0;
$userManagementTable->rowclass['captions_fields_admin_user'] = 'field_half_width w50p'; $userManagementTable->rowclass['captions_fields_admin_user'] = 'field_half_width w50p';
$userManagementTable->cellclass['captions_fields_admin_user'][0] = 'wrap'; $userManagementTable->cellclass['captions_fields_admin_user'][$fieldsAdminUserCount] = 'wrap';
$userManagementTable->data['captions_fields_admin_user'][0] = $doubleAuthentication; if (empty($doubleAuthentication) === false) {
$userManagementTable->data['captions_fields_admin_user'][$fieldsAdminUserCount] = $doubleAuthentication;
$fieldsAdminUserCount++;
}
if (users_is_admin() === true) { if (users_is_admin() === true) {
$globalProfileContent = []; $globalProfileContent = [];
$globalProfileContent[] = '<span>'.__('Administrator user').'</span>'; $globalProfileContent[] = '<span>'.__('Administrator user').'</span>';
@ -233,8 +238,8 @@ if (users_is_admin() === true) {
true true
); );
$userManagementTable->cellclass['captions_fields_admin_user'][1] = 'wrap'; $userManagementTable->cellclass['captions_fields_admin_user'][$fieldsAdminUserCount] = 'wrap';
$userManagementTable->data['captions_fields_admin_user'][1] = html_print_div( $userManagementTable->data['captions_fields_admin_user'][$fieldsAdminUserCount] = html_print_div(
[ [
'class' => 'margin-top-10', 'class' => 'margin-top-10',
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;', 'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
@ -703,6 +708,34 @@ $userManagementTable->data['fields_addSettings'][1] .= html_print_div(
true true
); );
$contentQrCode = [];
$contentQrCode[] = html_print_image(
'images/example_qr.png',
true,
[
'width' => '200px',
'height' => '200px',
]
);
$contentQrCode[] = '<span class="input_sub_placeholder input_sub_placeholder_qrcode">'.__('Generated automatically with the information provided for the user').'</span>';
$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); html_print_table($userManagementTable);
// User Profile definition table. (Only where user is not creating). // User Profile definition table. (Only where user is not creating).
if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) { if ($new_user === false && ((bool) check_acl($config['id_user'], 0, 'UM') === true)) {

View File

@ -3449,7 +3449,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$output = ''; $output = '';
$classes = ''; $classes = '';
$fixedId = ''; $fixedId = '';
$iconStyle = '';
$spanStyle = 'margin-top: 4px;';
if (empty($name) === true) { if (empty($name) === true) {
$name = 'unnamed'; $name = 'unnamed';
} }
@ -3477,6 +3478,10 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$classes .= ' '.$value; $classes .= ' '.$value;
} else if ($attribute === 'fixed_id') { } else if ($attribute === 'fixed_id') {
$fixedId = $value; $fixedId = $value;
} else if ($attribute === 'icon_style') {
$iconStyle = $value;
} else if ($attribute === 'span_style') {
$spanStyle .= $value;
} else if ($attribute === 'rawAttributes') { } else if ($attribute === 'rawAttributes') {
$buttonType = ($attr_array['type'] ?? 'button'); $buttonType = ($attr_array['type'] ?? 'button');
$buttonAttributes = $value; $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')) { if (empty($iconToUse) === false || (isset($buttonMode) === true && $buttonMode !== 'onlyIcon')) {
$iconDiv = html_print_div( $iconDiv = html_print_div(
[ [
'style' => '', 'style' => $iconStyle,
'class' => sprintf( 'class' => sprintf(
'subIcon %s %s', 'subIcon %s %s',
$iconToUse, $iconToUse,
@ -3510,7 +3515,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
$mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name); $mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name);
if ($imageButton === false) { if ($imageButton === false) {
$content = '<span id="span-'.$mainId.'" style="margin-top: 4px;" class="font_11">'.$label.'</span>'; $content = '<span id="span-'.$mainId.'" style="'.$spanStyle.'" class="font_11">'.$label.'</span>';
$content .= $iconDiv; $content .= $iconDiv;
} else { } else {
$content = $iconDiv; $content = $iconDiv;

View File

@ -11174,6 +11174,24 @@ form#satellite_conf_edit > fieldset.full-column {
z-index: 50; 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 { .action-buttons > button {
margin: 10px; margin: 10px;
} }