Skip to content

Commit 906d44b

Browse files
author
Stanislav Idolov
authored
MAGETWO-82598: Fix Support for new Email address domain #4547 #11576
2 parents 52833e0 + e6d2d0b commit 906d44b

File tree

9 files changed

+19
-11
lines changed

9 files changed

+19
-11
lines changed

app/code/Magento/Config/Model/Config/Backend/Email/Address.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class Address extends \Magento\Framework\App\Config\Value
2020
public function beforeSave()
2121
{
2222
$value = $this->getValue();
23-
if (!\Zend_Validate::is($value, 'EmailAddress')) {
23+
$validator = new \Zend\Validator\EmailAddress();
24+
if (!$validator->isValid($value)) {
2425
throw new LocalizedException(__('Please correct the email address: "%1".', $value));
2526
}
2627
return $this;

app/code/Magento/Contact/Controller/Index/Post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ public function execute()
4343
if (!\Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
4444
$error = true;
4545
}
46-
if (!\Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
46+
$validator = new \Zend\Validator\EmailAddress();
47+
if (!$validator->isValid(trim($post['email']))) {
4748
$error = true;
4849
}
4950
if (\Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {

app/code/Magento/Customer/Controller/Account/ForgotPasswordPost.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ public function execute()
6060
$resultRedirect = $this->resultRedirectFactory->create();
6161
$email = (string)$this->getRequest()->getPost('email');
6262
if ($email) {
63-
if (!\Zend_Validate::is($email, 'EmailAddress')) {
63+
$validator = new \Zend\Validator\EmailAddress();
64+
if (!$validator->isValid($email)) {
6465
$this->session->setForgottenEmail($email);
6566
$this->messageManager->addErrorMessage(__('Please correct the email address.'));
6667
return $resultRedirect->setPath('*/*/forgotpassword');

app/code/Magento/CustomerImportExport/Model/Import/AbstractCustomer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ protected function _checkUniqueKey(array $rowData, $rowNumber)
231231
} else {
232232
$email = strtolower($rowData[static::COLUMN_EMAIL]);
233233
$website = $rowData[static::COLUMN_WEBSITE];
234-
235-
if (!\Zend_Validate::is($email, 'EmailAddress')) {
234+
$validator = new \Zend\Validator\EmailAddress();
235+
if (!$validator->isValid($email)) {
236236
$this->addRowError(static::ERROR_INVALID_EMAIL, $rowNumber, static::COLUMN_EMAIL);
237237
} elseif (!isset($this->_websiteCodeToId[$website])) {
238238
$this->addRowError(static::ERROR_INVALID_WEBSITE, $rowNumber, static::COLUMN_WEBSITE);

app/code/Magento/Newsletter/Controller/Subscriber/NewAction.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ protected function validateGuestSubscription()
100100
*/
101101
protected function validateEmailFormat($email)
102102
{
103-
if (!\Zend_Validate::is($email, 'EmailAddress')) {
103+
$validator = new \Zend\Validator\EmailAddress();
104+
if ($validator->isValid($email)) {
104105
throw new \Magento\Framework\Exception\LocalizedException(__('Please enter a valid email address.'));
105106
}
106107
}

app/code/Magento/Quote/Model/Quote/Address/Validator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function isValid($value)
3939
{
4040
$messages = [];
4141
$email = $value->getEmail();
42-
if (!empty($email) && !\Zend_Validate::is($email, 'EmailAddress')) {
42+
$validator = new \Zend\Validator\EmailAddress();
43+
if (!empty($email) && !$validator->isValid($email)) {
4344
$messages['invalid_email_format'] = 'Invalid email format';
4445
}
4546

app/code/Magento/SendFriend/Model/SendFriend.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ public function validate()
235235
}
236236

237237
$email = $this->getSender()->getEmail();
238-
if (empty($email) or !\Zend_Validate::is($email, 'EmailAddress')) {
238+
$validator = new \Zend\Validator\EmailAddress();
239+
if (empty($email) or !$validator->isValid($email)) {
239240
$errors[] = __('Invalid Sender Email');
240241
}
241242

@@ -250,7 +251,7 @@ public function validate()
250251

251252
// validate recipients email addresses
252253
foreach ($this->getRecipients()->getEmails() as $email) {
253-
if (!\Zend_Validate::is($email, 'EmailAddress')) {
254+
if (!$validator->isValid($email)) {
254255
$errors[] = __('Please enter a correct recipient email address.');
255256
break;
256257
}

app/code/Magento/User/Controller/Adminhtml/Auth/Forgotpassword.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function execute()
4444
$resultRedirect = $this->resultRedirectFactory->create();
4545
if (!empty($email) && !empty($params)) {
4646
// Validate received data to be an email address
47-
if (\Zend_Validate::is($email, 'EmailAddress')) {
47+
$validator = new \Zend\Validator\EmailAddress();
48+
if ($validator->isValid($email)) {
4849
try {
4950
$this->securityManager->performSecurityCheck(
5051
\Magento\Security\Model\PasswordResetRequestEvent::ADMIN_PASSWORD_RESET_REQUEST,

app/code/Magento/Wishlist/Controller/Index/Send.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ public function execute()
153153
} else {
154154
foreach ($emails as $index => $email) {
155155
$email = trim($email);
156-
if (!\Zend_Validate::is($email, 'EmailAddress')) {
156+
$validator = new \Zend\Validator\EmailAddress();
157+
if (!$validator->isValid($email)) {
157158
$error = __('Please enter a valid email address.');
158159
break;
159160
}

0 commit comments

Comments
 (0)