#12517 hide allowlist if token is disabled
This commit is contained in:
parent
2576303566
commit
c16992f69a
|
@ -857,10 +857,34 @@ $userManagementTable->data['fields_addSettings'][0] = html_print_textarea(
|
|||
''
|
||||
);
|
||||
|
||||
$userManagementTable->data['captions_addSettings'][1] = __('Login allowed IP list');
|
||||
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
|
||||
$allowAllIpsContent = [];
|
||||
$allowAllIpsContent[] = '<span>'.__('Enable IP allowlist').'</span>';
|
||||
$allowAllIpsContent[] = html_print_div(
|
||||
[
|
||||
'class' => 'edit_user_allowed_ip',
|
||||
'content' => html_print_checkbox_switch(
|
||||
'allowed_ip_active',
|
||||
0,
|
||||
($user_info['allowed_ip_active'] ?? 0),
|
||||
true,
|
||||
false,
|
||||
'handleIpAllowlist(this)'
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['captions_addSettings'][1] = html_print_div(
|
||||
[
|
||||
'class' => 'margin-top-10',
|
||||
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
|
||||
'content' => implode('', $allowAllIpsContent),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
|
||||
[
|
||||
'class' => 'edit_user_allowed_ip '.(((int) $user_info['allowed_ip_active'] === 1) ? '' : 'invisible'),
|
||||
'content' => html_print_textarea(
|
||||
'allowed_ip_list',
|
||||
5,
|
||||
|
@ -875,30 +899,11 @@ $userManagementTable->data['fields_addSettings'][1] = html_print_div(
|
|||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
|
||||
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
|
||||
true
|
||||
);
|
||||
|
||||
$allowAllIpsContent = [];
|
||||
$allowAllIpsContent[] = '<span>'.__('Allow all IPs').'</span>';
|
||||
$allowAllIpsContent[] = html_print_div(
|
||||
true,
|
||||
[
|
||||
'content' => html_print_checkbox_switch(
|
||||
'allowed_ip_active',
|
||||
0,
|
||||
($user_info['allowed_ip_active'] ?? 0),
|
||||
true
|
||||
),
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$userManagementTable->data['fields_addSettings'][1] .= html_print_div(
|
||||
[
|
||||
'class' => 'margin-top-10',
|
||||
'style' => 'display: flex; flex-direction: row-reverse; align-items: center;',
|
||||
'content' => implode('', $allowAllIpsContent),
|
||||
],
|
||||
true
|
||||
'id' => 'info_allowed_ip',
|
||||
'class' => ((int) $user_info['allowed_ip_active'] === 1) ? 'input_sub_placeholder' : 'input_sub_placeholder invisible',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
|
@ -1038,4 +1043,14 @@ $(document).ready(function () {
|
|||
}
|
||||
})
|
||||
});
|
||||
|
||||
function handleIpAllowlist(e){
|
||||
if(e.checked === true) {
|
||||
$('.edit_user_allowed_ip').show();
|
||||
$('#info_allowed_ip').show();
|
||||
} else {
|
||||
$('.edit_user_allowed_ip').hide();
|
||||
$('#info_allowed_ip').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue