Skip to content
Snippets Groups Projects
Commit 20337e91 authored by Paul Ilea's avatar Paul Ilea
Browse files

[TASK] Accept only alphanumeric values for forms marker names

parent 562c4ea5
No related branches found
No related tags found
No related merge requests found
...@@ -83,9 +83,13 @@ class FormsFinisher extends AbstractFinisher { ...@@ -83,9 +83,13 @@ class FormsFinisher extends AbstractFinisher {
$formElementProperties = $formElement->getProperties(); $formElementProperties = $formElement->getProperties();
if (isset($formElementProperties['markerName']) && \trim($formElementProperties['markerName']) !== '') { if (isset($formElementProperties['markerName']) && \trim($formElementProperties['markerName']) !== '') {
$markers[\trim($formElementProperties['markerName'])] = $value; $markerName = \trim($formElementProperties['markerName']);
} else { } else {
$markers[$identifier] = $value; $markerName = $identifier;
}
$markerName = preg_replace('/[^a-zA-Z0-9]/', '', $markerName);
if (!isset($markers[$markerName])) {
$markers[$markerName] = $value;
} }
} }
......
...@@ -168,13 +168,22 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll ...@@ -168,13 +168,22 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll
if (isset($element['properties']['markerName']) && $element['properties']['markerName'] !== '') { if (isset($element['properties']['markerName']) && $element['properties']['markerName'] !== '') {
$markerName = $element['properties']['markerName']; $markerName = $element['properties']['markerName'];
} }
$markerName = preg_replace('/[^a-zA-Z0-9]/', '', $markerName);
$markers[] = [ $duplicateMarker = FALSE;
'identifier' => $markerName, foreach ($markers as $marker) {
'type' => MailTemplateService::MARKER_TYPE_STRING, if ($marker['identifier'] === $markerName) {
'value' => $element['label'], $duplicateMarker = TRUE;
'description' => $element['label'] break;
]; }
}
if (!$duplicateMarker) {
$markers[] = [
'identifier' => $markerName,
'type' => MailTemplateService::MARKER_TYPE_STRING,
'value' => $element['label'],
'description' => $element['label']
];
}
} }
$registrationService = $this->objectManager->get(RegisterService::class); $registrationService = $this->objectManager->get(RegisterService::class);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment