Fixed tokens htpp_auth user,avoid repetiton

This commit is contained in:
Luis Calvo 2020-12-17 17:42:53 +01:00
parent b5d52a5afe
commit a8ab897d44
1 changed files with 34 additions and 15 deletions

View File

@ -1570,6 +1570,16 @@ if ($update_module) {
'module_macros' => $module_macros, 'module_macros' => $module_macros,
]; ];
if (preg_match('/http_auth_user/m', $values['plugin_parameter'])) {
$http_user_conf = true;
}
if (preg_match('/http_auth_pass/m', $values['plugin_parameter'])) {
$http_pass_conf = true;
}
if (!$http_user_conf || !$http_pass_conf) {
if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) { if ($id_module_type == 30 || $id_module_type == 31 || $id_module_type == 32 || $id_module_type == 33) {
$plugin_parameter_split = explode('
', $values['plugin_parameter']); $plugin_parameter_split = explode('
', $values['plugin_parameter']);
@ -1578,10 +1588,18 @@ if ($update_module) {
foreach ($plugin_parameter_split as $key => $value) { foreach ($plugin_parameter_split as $key => $value) {
if ($key == 1) { if ($key == 1) {
if ($http_user) { if ($http_user) {
if ($http_user_conf) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
'; $values['plugin_parameter'] .= 'http_auth_user '.$http_user.'
';
} }
if ($http_pass) { if ($http_pass) {
if ($http_user_pass) {
continue;
}
$values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
'; $values['plugin_parameter'] .= 'http_auth_pass '.$http_pass.'
';
} }
@ -1591,6 +1609,7 @@ if ($update_module) {
} }
} }
} }
}
// In local modules, the interval is updated by agent. // In local modules, the interval is updated by agent.
$module_kind = (int) get_parameter('moduletype'); $module_kind = (int) get_parameter('moduletype');