Skip to content

Commit

Permalink
Fixed issue #18786: Error shown when token length is set to 36 charac…
Browse files Browse the repository at this point in the history
…ters
  • Loading branch information
c-schmitz committed Apr 25, 2023
1 parent aad3f32 commit 19bf0d5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions application/controllers/admin/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,7 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
}

$oSurvey->googleanalyticsstyle = $this->filterEmptyFields($oSurvey, 'googleanalyticsstyle');

$tokenlength = $this->filterEmptyFields($oSurvey, 'tokenlength');
$oSurvey->tokenlength = (int) ((($tokenlength < 5 || $tokenlength > 36) && $tokenlength != -1) ? 15 : $tokenlength);

$oSurvey->tokenlength = $this->filterEmptyFields($oSurvey, 'tokenlength');
$event = new PluginEvent('beforeSurveySettingsSave');
$event->set('modifiedSurvey', $oSurvey);
App()->getPluginManager()->dispatchEvent($event);
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1341,8 +1341,8 @@ function XMLImportSurvey($sFullFilePath, $sXMLdata = null, $sNewSurveyName = nul
unset($insertdata['allowjumps']);
}

if (isset($insertdata['tokenlength']) && $insertdata['tokenlength'] > 35) {
$insertdata['tokenlength'] = 35;
if (isset($insertdata['tokenlength']) && $insertdata['tokenlength'] > Token::MAX_LENGTH) {
$insertdata['tokenlength'] = Token::MAX_LENGTH;
}
/* Remove unknow column */
$aSurveyModelsColumns = Survey::model()->attributes;
Expand Down
2 changes: 1 addition & 1 deletion application/models/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public function rules()
array('googleanalyticsstyle', 'numerical', 'integerOnly' => true, 'min' => '0', 'max' => '3', 'allowEmpty' => true),
array('autonumber_start', 'numerical', 'integerOnly' => true, 'allowEmpty' => true),
array('tokenlength', 'default', 'value' => 15),
array('tokenlength', 'numerical', 'integerOnly' => true, 'allowEmpty' => false, 'min' => '-1', 'max' => '35'),
array('tokenlength', 'numerical', 'integerOnly' => true, 'allowEmpty' => false, 'min' => '-1', 'max' => Token::MAX_LENGTH, 'tooBig' => gT('Token length cannot be bigger than {max} characters.')),
array('bouncetime', 'numerical', 'integerOnly' => true, 'allowEmpty' => true),
array('navigationdelay', 'numerical', 'integerOnly' => true, 'allowEmpty' => true),
array('template', 'filter', 'filter' => array($this, 'filterTemplateSave')),
Expand Down

0 comments on commit 19bf0d5

Please sign in to comment.