Skip to content

Commit fc7ed09

Browse files
author
Olga Kopylova
committed
Merge remote-tracking branch 'folks/bugs' into MAGETWO-37728-lost-option-in-generator
2 parents 908829f + 3ff5dda commit fc7ed09

File tree

6 files changed

+35
-4
lines changed

6 files changed

+35
-4
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ define(
110110
this.source.set('params.invalid', false);
111111
fields.trigger('change');
112112
this.source.trigger('billingAddress.data.validate');
113+
if (!customer.isLoggedIn()()) {
114+
this.source.trigger('customerDetails.data.validate');
115+
}
113116
this.validateAdditionalAddressFields();
114117
},
115118
validateAdditionalAddressFields: function() {

app/code/Magento/Customer/Block/CustomerData.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@ public function getCookieLifeTime()
1818
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
1919
);
2020
}
21+
22+
/**
23+
* Get url for customer data ajax requests. Returns url with protocol matching used to request page.
24+
*
25+
* @param string $route
26+
* @return string Customer data url.
27+
*/
28+
public function getCustomerDataUrl($route)
29+
{
30+
return $this->getUrl($route, ['_secure' => $this->getRequest()->isSecure()]);
31+
}
2132
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<argument name="secureUrlList" xsi:type="array">
1212
<item name="customer" xsi:type="string">/customer/</item>
1313
</argument>
14+
<argument name="excludedUrlList" xsi:type="array">
15+
<item name="customer_sections" xsi:type="string">/customer/section/load</item>
16+
</argument>
1417
</arguments>
1518
</type>
1619
<type name="Magento\Framework\View\Layout">

app/code/Magento/Customer/view/frontend/templates/js/customer-data.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<?php
1212
echo $this->helper('Magento\Framework\Json\Helper\Data')->jsonEncode([
1313
'*' => ['Magento_Customer/js/customer-data' => [
14-
'sectionLoadUrl' => $block->getUrl('customer/section/load'),
14+
'sectionLoadUrl' => $block->getCustomerDataUrl('customer/section/load'),
1515
'cookieLifeTime' => $block->getCookieLifeTime(),
1616
]],
1717
]);

lib/internal/Magento/Framework/Url/SecurityInfo.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface
1616
*/
1717
protected $secureUrlsList = [];
1818

19+
/**
20+
* List of patterns excluded form secure url list
21+
*/
22+
protected $excludedUrlsList = [];
23+
1924
/**
2025
* List of already checked urls
2126
*
@@ -25,10 +30,12 @@ class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface
2530

2631
/**
2732
* @param string[] $secureUrlList
33+
* @param string[] $excludedUrlList
2834
*/
29-
public function __construct($secureUrlList = [])
35+
public function __construct($secureUrlList = [], $excludedUrlList = [])
3036
{
3137
$this->secureUrlsList = $secureUrlList;
38+
$this->excludedUrlsList = $excludedUrlList;
3239
}
3340

3441
/**
@@ -41,6 +48,11 @@ public function isSecure($url)
4148
{
4249
if (!isset($this->secureUrlsCache[$url])) {
4350
$this->secureUrlsCache[$url] = false;
51+
foreach ($this->excludedUrlsList as $match) {
52+
if (strpos($url, (string)$match) === 0) {
53+
return $this->secureUrlsCache[$url];
54+
}
55+
}
4456
foreach ($this->secureUrlsList as $match) {
4557
if (strpos($url, (string)$match) === 0) {
4658
$this->secureUrlsCache[$url] = true;

lib/internal/Magento/Framework/Url/Test/Unit/SecurityInfoTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SecurityInfoTest extends \PHPUnit_Framework_TestCase
1919

2020
protected function setUp()
2121
{
22-
$this->_model = new \Magento\Framework\Url\SecurityInfo(['/account', '/cart']);
22+
$this->_model = new \Magento\Framework\Url\SecurityInfo(['/account', '/cart'], ['/cart/remove', 'customer']);
2323
}
2424

2525
/**
@@ -39,7 +39,9 @@ public function secureUrlDataProvider()
3939
['/product', false],
4040
['/product/12312', false],
4141
['/cart', true],
42-
['/cart/add', true]
42+
['/cart/add', true],
43+
['/cart/remove', false],
44+
['/customer', false]
4345
];
4446
}
4547
}

0 commit comments

Comments
 (0)