#13035 fixed bug when add node with api
This commit is contained in:
parent
68633e032d
commit
7c1cc07ea9
|
@ -195,22 +195,27 @@ final class JWTRepository
|
||||||
*/
|
*/
|
||||||
public static function syncSignatureWithNodes(?string $signature):void
|
public static function syncSignatureWithNodes(?string $signature):void
|
||||||
{
|
{
|
||||||
global $config;
|
if (function_exists('metaconsole_get_servers') === true
|
||||||
if (function_exists('metaconsole_get_servers') === true) {
|
&& function_exists('metaconsole_push_conf_to_node') === true
|
||||||
$sync = false;
|
) {
|
||||||
|
$sync_server = 0;
|
||||||
$servers = metaconsole_get_servers();
|
$servers = metaconsole_get_servers();
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
$config['JWT_signature'] = 1;
|
$ok_sync = metaconsole_push_conf_to_node(
|
||||||
if (metaconsole_connect($server) == NOERR) {
|
$server,
|
||||||
config_update_value('JWT_signature', $signature, true);
|
[ 'JWT_signature' => $signature],
|
||||||
$sync = true;
|
true
|
||||||
}
|
);
|
||||||
|
|
||||||
$config['JWT_signature'] = 1;
|
if ($ok_sync === true) {
|
||||||
metaconsole_restore_db();
|
$sync_server++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sync === true) {
|
if (is_array($servers) === true
|
||||||
|
&& count($servers) === $sync_server
|
||||||
|
&& count($servers) > 0
|
||||||
|
) {
|
||||||
config_update_value('JWT_signature', $signature, true);
|
config_update_value('JWT_signature', $signature, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2748,7 +2748,10 @@ function redirectNode(url, target = "_blank") {
|
||||||
get_jwt_for_login: 1
|
get_jwt_for_login: 1
|
||||||
},
|
},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var $form = $(`<form class='invisible' target='${target}'></form>`);
|
const unique_id = "token_form_" + uniqId();
|
||||||
|
var $form = $(
|
||||||
|
`<form class="invisible" id="${unique_id}" target="${target}"></form>`
|
||||||
|
);
|
||||||
$form.attr("method", "post");
|
$form.attr("method", "post");
|
||||||
$form.attr("action", url);
|
$form.attr("action", url);
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
|
@ -2761,6 +2764,7 @@ function redirectNode(url, target = "_blank") {
|
||||||
|
|
||||||
$("body").append($form);
|
$("body").append($form);
|
||||||
$form.submit();
|
$form.submit();
|
||||||
|
$("#" + unique_id).remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue