Skip to content

Commit c1031e2

Browse files
committed
ACP2E-2037: allow diacritics validation only for email address
1 parent 3dbea76 commit c1031e2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/code/Magento/Customer/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@
588588
</type>
589589
<type name="Magento\Eav\Model\Attribute\Data\Text">
590590
<arguments>
591-
<argument name="encodeAttributesByTypesList" xsi:type="array">
591+
<argument name="allowDiacriticsForAttributes" xsi:type="array">
592592
<item name="customer" xsi:type="array">
593593
<item name="email" xsi:type="string">email</item>
594594
</item>

app/code/Magento/Eav/Model/Attribute/Data/Text.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ class Text extends \Magento\Eav\Model\Attribute\Data\AbstractData
2727
/**
2828
* @var array
2929
*/
30-
private $encodeAttributesByTypesList;
30+
private $allowDiacriticsForAttributes;
3131

3232
/**
3333
* @param TimezoneInterface $localeDate
3434
* @param LoggerInterface $logger
3535
* @param ResolverInterface $localeResolver
3636
* @param StringUtils $stringHelper
37-
* @param array $encodeAttributesByTypesList
37+
* @param array $allowDiacriticsForAttributes
3838
* @codeCoverageIgnore
3939
*/
4040
public function __construct(
4141
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
4242
\Psr\Log\LoggerInterface $logger,
4343
\Magento\Framework\Locale\ResolverInterface $localeResolver,
4444
\Magento\Framework\Stdlib\StringUtils $stringHelper,
45-
array $encodeAttributesByTypesList = []
45+
array $allowDiacriticsForAttributes = []
4646
) {
4747
parent::__construct($localeDate, $logger, $localeResolver);
4848
$this->_string = $stringHelper;
49-
$this->encodeAttributesByTypesList = $encodeAttributesByTypesList;
49+
$this->allowDiacriticsForAttributes = $allowDiacriticsForAttributes;
5050
}
5151

5252
/**
@@ -91,7 +91,11 @@ public function validateValue($value)
9191
return $errors;
9292
}
9393

94-
if (in_array($attribute->getAttributeCode(), $this->encodeAttributesByTypesList[$attribute->getEntityType()->getEntityTypeCode()])) {
94+
if (isset($this->allowDiacriticsForAttributes[$this->getAttribute()->getEntityType()->getEntityTypeCode()])
95+
&& in_array(
96+
$this->getAttribute()->getAttributeCode(),
97+
$this->allowDiacriticsForAttributes[$this->getAttribute()->getEntityType()->getEntityTypeCode()]
98+
)) {
9599
// if string with diacritics encode it.
96100
$value = $this->encodeDiacritics($value);
97101
}

0 commit comments

Comments
 (0)