Skip to content

Commit b8d8c7a

Browse files
committed
Merge branch 'ACP2E-2503' of https://github.com/magento-l3/magento2ce into Tier4-PR-10-30-2023
2 parents edd599b + 89797dd commit b8d8c7a

File tree

6 files changed

+14
-19
lines changed

6 files changed

+14
-19
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public function beforeSave()
3030
);
3131
}
3232

33+
if (str_contains($value, ":")) {
34+
throw new \Magento\Framework\Exception\LocalizedException(
35+
__('The sender name "%1" is not valid. The colon character is not allowed.', $value)
36+
);
37+
}
38+
3339
if (strlen($value) > 255) {
3440
throw new \Magento\Framework\Exception\LocalizedException(
3541
__('Maximum sender name length is 255. Please correct your settings.')

app/code/Magento/Config/Test/Unit/Model/Config/Backend/Email/SenderTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function beforeSaveDataProvider()
5151
{
5252
return [
5353
['Mr. Real Name', 'Mr. Real Name'],
54+
['No colons:', false],
5455
[str_repeat('a', 256), false],
5556
[null, false],
5657
['', false],

app/code/Magento/Config/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ System,System
3838
"Sorry, the default display currency you selected is not available in allowed currencies.","Sorry, the default display currency you selected is not available in allowed currencies."
3939
"The ""%1"" email address is incorrect. Verify the email address and try again.","The ""%1"" email address is incorrect. Verify the email address and try again."
4040
"The sender name ""%1"" is not valid. Please use only visible characters and spaces.","The sender name ""%1"" is not valid. Please use only visible characters and spaces."
41+
"The sender name ""%1"" is not valid. The colon character is not allowed.","The sender name ""%1"" is not valid. The colon character is not allowed."
4142
"Maximum sender name length is 255. Please correct your settings.","Maximum sender name length is 255. Please correct your settings."
4243
"The file you're uploading exceeds the server size limit of %1 kilobytes.","The file you're uploading exceeds the server size limit of %1 kilobytes."
4344
"The base directory to upload file is not specified.","The base directory to upload file is not specified."

dev/tests/js/jasmine/tests/lib/mage/validation.test.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -371,25 +371,11 @@ define([
371371
describe('Testing validate-emailSender', function () {
372372
it('validate-emailSender', function () {
373373
expect($.validator.methods['validate-emailSender']
374-
.call($.validator.prototype, '')).toEqual(true);
374+
.call($.validator.prototype, 'Sender Name')).toEqual(true);
375375
expect($.validator.methods['validate-emailSender']
376-
.call($.validator.prototype, null)).toEqual(true);
376+
.call($.validator.prototype, 'Sender & Name')).toEqual(true);
377377
expect($.validator.methods['validate-emailSender']
378-
.call($.validator.prototype, undefined)).toEqual(true);
379-
expect($.validator.methods['validate-emailSender']
380-
.call($.validator.prototype, ' ')).toEqual(true);
381-
expect($.validator.methods['validate-emailSender']
382-
.call($.validator.prototype, '[email protected]')).toEqual(true);
383-
expect($.validator.methods['validate-emailSender']
384-
.call($.validator.prototype, '[email protected]')).toEqual(true);
385-
expect($.validator.methods['validate-emailSender']
386-
.call($.validator.prototype, '[email protected]')).toEqual(true);
387-
expect($.validator.methods['validate-emailSender']
388-
.call($.validator.prototype, '[email protected]')).toEqual(true);
389-
expect($.validator.methods['validate-emailSender']
390-
.call($.validator.prototype, '[email protected]')).toEqual(true);
391-
expect($.validator.methods['validate-emailSender']
392-
.call($.validator.prototype, '[email protected]')).toEqual(true);
378+
.call($.validator.prototype, 'Sender: Name')).toEqual(false);
393379
});
394380
});
395381

lib/web/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Submit,Submit
5050
"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890."
5151
"Please enter a valid fax number (Ex: 123-456-7890).","Please enter a valid fax number (Ex: 123-456-7890)."
5252
"Please enter a valid email address (Ex: [email protected]).","Please enter a valid email address (Ex: [email protected])."
53+
"Please use only visible characters and spaces. The colon character is not allowed.","Please use only visible characters and spaces. The colon character is not allowed."
5354
"Please enter 6 or more characters. Leading and trailing spaces will be ignored.","Please enter 6 or more characters. Leading and trailing spaces will be ignored."
5455
"Please enter 7 or more characters, using both numeric and alphabetic.","Please enter 7 or more characters, using both numeric and alphabetic."
5556
"Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored.","Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored."

lib/web/mage/validation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,9 @@ define([
646646
],
647647
'validate-emailSender': [
648648
function (v) {
649-
return $.mage.isEmptyNoTrim(v) || /^[\S ]+$/.test(v);
649+
return $.mage.isEmptyNoTrim(v) || /^(?!.*:)[\S ]+$/.test(v);
650650
},
651-
$.mage.__('Please enter a valid email address (Ex: [email protected]).')
651+
$.mage.__('Please use only visible characters and spaces. The colon character is not allowed.')
652652
],
653653
'validate-password': [
654654
function (v) {

0 commit comments

Comments
 (0)