N°3430 - fix preference page's warning and add missing token generation

- fix the warning (ajax call interrupted) if preference form ajax call is way faster than the one of the 2 other by adding a new timeout_duration option before the redirect.
This commit is contained in:
bruno-ds
2021-02-18 12:18:38 +01:00
parent 83434b5506
commit e9e18513be
7 changed files with 32 additions and 17 deletions

View File

@@ -160,7 +160,9 @@ abstract class FormManager
/**
* @param array|null $aArgs
*
* @return mixed
* @return array
*
* @since 2.7.4 3.0.0 N°3430
*/
public function OnSubmit($aArgs = null)
{
@@ -179,13 +181,16 @@ abstract class FormManager
}
/**
* @param $aData
* @param array $aData
*
* @return array
*
* @since 2.7.4 3.0.0 N°3430
*/
public function CheckTransaction($aData)
{
if (! \utils::IsTransactionValid($this->oForm->GetTransactionId())) {
$isTransactionValid = \utils::IsTransactionValid($this->oForm->GetTransactionId(), false); //The transaction token is kept in order to preserve BC with ajax forms (the second call would fail if the token is deleted). (The GC will take care of cleaning the token for us later on)
if (!$isTransactionValid) {
$aData['messages']['error'] += [
'_main' => [\Dict::S('UI:Error:InvalidToken')] //This message is generic, if you override this method you should use a more precise message. @see \Combodo\iTop\Portal\Form\ObjectFormManager::CheckTransaction
];