Skip to content

Commit

Permalink
Fixed issue #16971: Unable to use encrypted token attribute in survey
Browse files Browse the repository at this point in the history
  • Loading branch information
ptelu authored and olleharstedt committed Mar 12, 2021
1 parent 048cfdc commit 200db35
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -3948,13 +3948,18 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid, $forc

$token = Token::model($surveyid)->findByToken($_SESSION[$this->sessid]['token']);
if ($token) {
$tokenEncryptionOptions = $survey->getTokenEncryptionOptions();
foreach ($token as $key => $val) {
$this->knownVars["TOKEN:" . strtoupper($key)] = array(
// Decrypt encrypted token attributes
if (isset($tokenEncryptionOptions['columns'][$key]) && $tokenEncryptionOptions['columns'][$key] === 'Y'){
$val = $token->decrypt($val);
}
$this->knownVars["TOKEN:" . strtoupper($key)] = [
'code' => $anonymized ? '' : $val,
'jsName_on' => '',
'jsName' => '',
'readWrite' => 'N',
);
];
}
}
} else {
Expand Down

0 comments on commit 200db35

Please sign in to comment.