diff --git a/datamodels/2.x/itop-backup/ajax.backup.php b/datamodels/2.x/itop-backup/ajax.backup.php index 2162f27ae7..f9619bb94e 100644 --- a/datamodels/2.x/itop-backup/ajax.backup.php +++ b/datamodels/2.x/itop-backup/ajax.backup.php @@ -137,6 +137,9 @@ try * As a result we're setting a token file to make sure the restore is called by an authenticated user with the correct rights ! */ case 'restore_get_token': + $oPage = new JsonPage(); + $oPage->SetOutputDataOnly(true); + $sEnvironment = utils::ReadParam('environment', 'production', false, 'raw_data'); $oRestoreMutex = new iTopMutex('restore.'.$sEnvironment); if ($oRestoreMutex->IsLocked()) @@ -149,12 +152,7 @@ try $sTokenFile = APPROOT.'/data/restore.'.$sToken.'.tok'; file_put_contents($sTokenFile, $sFile); - $oPage->add_ready_script( - <<SetData(['token' => $sToken]); $oPage->output(); break; diff --git a/datamodels/2.x/itop-backup/status.php b/datamodels/2.x/itop-backup/status.php index 68a495fa43..da8eb74f9d 100644 --- a/datamodels/2.x/itop-backup/status.php +++ b/datamodels/2.x/itop-backup/status.php @@ -471,7 +471,7 @@ function LaunchRestoreNow(sBackupFile, sConfirmationMessage) $.post(GetAbsoluteUrlModulePage('itop-backup', 'ajax.backup.php'), oParams, function(data){ // Get the value of restore_token - $('#backup_errors').append(data); + $('#restore_token').val(data.token); var oParams = {}; oParams.operation = 'restore_exec';