Skip to content

Commit 638456a

Browse files
committed
Skip password and modified fields while import, do not subscribe blacklisted users
1 parent feea299 commit 638456a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Domain/Subscription/Service/SubscriberCsvImporter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private function processRow(
174174

175175
$this->processAttributes($subscriber, $dto);
176176

177-
if (count($options->listIds) > 0) {
177+
if (!$subscriber->isBlacklisted() && count($options->listIds) > 0) {
178178
foreach ($options->listIds as $listId) {
179179
$this->subscriptionManager->addSubscriberToAList($subscriber, $listId);
180180
}
@@ -190,6 +190,12 @@ private function processRow(
190190
private function processAttributes(Subscriber $subscriber, ImportSubscriberDto $dto): void
191191
{
192192
foreach ($dto->extraAttributes as $key => $value) {
193+
$lowerKey = strtolower((string)$key);
194+
// Do not import or update sensitive/system fields from CSV
195+
if (in_array($lowerKey, ['password', 'modified'], true)) {
196+
continue;
197+
}
198+
193199
$attributeDefinition = $this->attrDefinitionRepository->findOneByName($key);
194200
if ($attributeDefinition !== null) {
195201
$this->attributeManager->createOrUpdate(

0 commit comments

Comments
 (0)