mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
#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');
|
$allowAllIpsContent = [];
|
||||||
$userManagementTable->data['fields_addSettings'][1] = html_print_div(
|
$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(
|
'content' => html_print_textarea(
|
||||||
'allowed_ip_list',
|
'allowed_ip_list',
|
||||||
5,
|
5,
|
||||||
@ -875,30 +899,11 @@ $userManagementTable->data['fields_addSettings'][1] = html_print_div(
|
|||||||
|
|
||||||
$userManagementTable->data['fields_addSettings'][1] .= ui_print_input_placeholder(
|
$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.'),
|
__('Add the source IPs that will allow console access. Each IP must be separated only by comma. * allows all.'),
|
||||||
true
|
true,
|
||||||
);
|
|
||||||
|
|
||||||
$allowAllIpsContent = [];
|
|
||||||
$allowAllIpsContent[] = '<span>'.__('Allow all IPs').'</span>';
|
|
||||||
$allowAllIpsContent[] = html_print_div(
|
|
||||||
[
|
[
|
||||||
'content' => html_print_checkbox_switch(
|
'id' => 'info_allowed_ip',
|
||||||
'allowed_ip_active',
|
'class' => ((int) $user_info['allowed_ip_active'] === 1) ? 'input_sub_placeholder' : 'input_sub_placeholder invisible',
|
||||||
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
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -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>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user