Skip to content

Commit 69f3cd0

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.4-develop
Accepted Community Pull Requests: - #32462: Fix incorrect setting of the SameSite cookie param (by @ihor-sviziev) - #32398: Category content upload media minify#31633 (by @gixid192) - #32393: Shipping radio button reorder#30257 (by @gixid192) Fixed GitHub Issues: - #26377: SameSite cookie, posible issues (reported by @diazwatson) has been fixed in #32462 by @ihor-sviziev in 2.4-develop branch Related commits: 1. bc5f97e 2. 41b935d 3. 35570b3 4. 753be2a - #32440: cookie lax append issue magento 2.4.2 upgrade enterprise b2b (reported by @sivamind) has been fixed in #32462 by @ihor-sviziev in 2.4-develop branch Related commits: 1. bc5f97e 2. 41b935d 3. 35570b3 4. 753be2a - #31633: Image details cannot be updated in new media gallery when JS Minificaiton is enabled (reported by @thomas-kl1) has been fixed in #32398 by @gixid192 in 2.4-develop branch Related commits: 1. 1be4239 2. e40e457 3. b54b852 4. 7dee9d8 5. 2821bc1 6. 2f7b55d 7. bff0f37 - #30257: [Clone MC-35417]Radio buttons are not displayed in the �Payment & Shipping Information� section in the case of reorder by Admin (reported by @magento-engcom-team) has been fixed in #32393 by @gixid192 in 2.4-develop branch Related commits: 1. 1be4239 2. e40e457 3. b54b852 4. 7dee9d8 5. 2821bc1 6. a57b22b
2 parents 986f564 + 09ec2f2 commit 69f3cd0

File tree

8 files changed

+22
-15
lines changed

8 files changed

+22
-15
lines changed

app/code/Magento/Cookie/view/base/web/js/jquery.storageapi.extended.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ define([
1616
* @private
1717
*/
1818
function _extend(storage) {
19+
var cookiesConfig = window.cookiesConfig || {};
20+
1921
$.extend(storage, {
20-
_secure: window.cookiesConfig ? window.cookiesConfig.secure : false,
21-
_samesite: window.cookiesConfig ? window.cookiesConfig.samesite : 'lax',
22+
_secure: !!cookiesConfig.secure,
23+
_samesite: cookiesConfig.samesite ? cookiesConfig.samesite : 'lax',
2224

2325
/**
2426
* Set value under name

app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/validation/validate-image-description.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212

1313
$.validator.addMethod(
1414
'validate-image-description', function (value) {
15-
return /^[a-zA-Z0-9\-\_\.\,\n\ ]+$|^$/i.test(value);
15+
return /^[a-zA-Z0-9\-\_\.\,\n\s]+$|^$/i.test(value);
1616

1717
}, $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9), ' +
1818
'dots (.), commas(,), underscores (_), dashes (-), and spaces on this field.'));

app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/validation/validate-image-title.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define([
1212

1313
$.validator.addMethod(
1414
'validate-image-title', function (value) {
15-
return /^[a-zA-Z0-9\-\_\.\,\ ]+$/i.test(value);
15+
return /^[a-zA-Z0-9\-\_\.\,\s]+$/i.test(value);
1616

1717
}, $.mage.__('Please use only letters (a-z or A-Z), numbers (0-9), dots (.), commas(,), ' +
1818
'underscores (_), dashes(-) and spaces on this field.'));

app/code/Magento/PageCache/view/frontend/web/js/form-key-provider.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ define(function () {
1818
var expires,
1919
secure,
2020
date = new Date(),
21-
isSecure = !!window.cookiesConfig && window.cookiesConfig.secure;
21+
cookiesConfig = window.cookiesConfig || {},
22+
isSecure = !!cookiesConfig.secure,
23+
samesite = cookiesConfig.samesite || 'lax';
2224

2325
date.setTime(date.getTime() + 86400000);
2426
expires = '; expires=' + date.toUTCString();
2527
secure = isSecure ? '; secure' : '';
28+
samesite = '; samesite=' + samesite;
2629

27-
document.cookie = 'form_key=' + (value || '') + expires + secure + '; path=/';
30+
document.cookie = 'form_key=' + (value || '') + expires + secure + '; path=/' + samesite;
2831
}
2932

3033
/**

app/code/Magento/Sales/view/adminhtml/templates/order/create/shipping/method/form.phtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ $taxHelper = $block->getData('taxHelper');
3838
value="<?= $block->escapeHtmlAttr($_code) ?>"
3939
id="s_method_<?= $block->escapeHtmlAttr($_code) ?>" <?= /* @noEscape */ $_checked ?>
4040
class="admin__control-radio required-entry"/>
41-
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
42-
'onclick',
43-
"order.setShippingMethod(this.value)",
44-
'input#s_method_' . $block->escapeHtmlAttr($_code)
45-
) ?>
4641
<label class="admin__field-label" for="s_method_<?= $block->escapeHtmlAttr($_code) ?>">
4742
<?= $block->escapeHtml($_rate->getMethodTitle() ?
4843
$_rate->getMethodTitle() : $_rate->getMethodDescription()) ?> -
@@ -59,6 +54,11 @@ $taxHelper = $block->getData('taxHelper');
5954
<?php endif; ?>
6055
</strong>
6156
</label>
57+
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
58+
'onclick',
59+
"order.setShippingMethod(this.value)",
60+
'input#s_method_' . $block->escapeHtmlAttr($_code)
61+
) ?>
6262
<?php endif; ?>
6363
</li>
6464
<?php endforeach; ?>

lib/web/jquery/jquery.cookie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
options.path ? '; path=' + options.path : '',
4848
options.domain ? '; domain=' + options.domain : '',
4949
options.secure ? '; secure' : '',
50-
options.samesite ? '; samesite=' + options.samesite : 'lax',
50+
'; samesite=' + (options.samesite ? options.samesite : 'lax'),
5151
].join(''));
5252
}
5353

lib/web/mage/adminhtml/tools.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ var Cookie = {
267267

268268
return null;
269269
},
270-
write: function (cookieName, cookieValue, cookieLifeTime) {
270+
write: function (cookieName, cookieValue, cookieLifeTime, samesite) {
271271
var expires = '';
272272

273273
if (cookieLifeTime) {
@@ -278,7 +278,9 @@ var Cookie = {
278278
}
279279
var urlPath = '/' + BASE_URL.split('/').slice(3).join('/'); // Get relative path
280280

281-
document.cookie = escape(cookieName) + '=' + escape(cookieValue) + expires + '; path=' + urlPath;
281+
samesite = '; samesite=' + (samesite ? samesite : 'lax');
282+
283+
document.cookie = escape(cookieName) + '=' + escape(cookieValue) + expires + '; path=' + urlPath + samesite;
282284
},
283285
clear: function (cookieName) {
284286
this.write(cookieName, '', -1);

lib/web/mage/cookies.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ define([
7676
(path ? '; path=' + path : '') +
7777
(domain ? '; domain=' + domain : '') +
7878
(secure ? '; secure' : '') +
79-
(samesite ? '; samesite=' + samesite : 'lax');
79+
'; samesite=' + (samesite ? samesite : 'lax');
8080
};
8181

8282
/**

0 commit comments

Comments
 (0)