Skip to content

Commit 8f24778

Browse files
merge magento-commerce/2.4-develop into magento-tsg/2.4-develop-pr135
2 parents 73f532b + 69f3cd0 commit 8f24778

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)