diff --git a/datamodels/2.x/itop-backup/ajax.backup.php b/datamodels/2.x/itop-backup/ajax.backup.php index 123f1a3e4..d00418d55 100644 --- a/datamodels/2.x/itop-backup/ajax.backup.php +++ b/datamodels/2.x/itop-backup/ajax.backup.php @@ -136,6 +136,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()) @@ -148,12 +151,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 dce347e14..6822ebd59 100644 --- a/datamodels/2.x/itop-backup/status.php +++ b/datamodels/2.x/itop-backup/status.php @@ -466,7 +466,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';