Skip to content

Commit 912e9e1

Browse files
author
Prabhu Ram
committed
Merge remote-tracking branch 'origin/MC-36977' into MC-36897
2 parents 7d0d006 + e9f6eed commit 912e9e1

File tree

30 files changed

+946
-190
lines changed

30 files changed

+946
-190
lines changed

app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,6 @@ private function getBillingAddressComponent($paymentCode, $elements)
351351
],
352352
],
353353
'telephone' => [
354-
'validation' => [
355-
'validate-phoneStrict' => 0,
356-
],
357354
'config' => [
358355
'tooltip' => [
359356
'description' => __('For delivery questions.'),

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutPhoneValidationTest.xml

Lines changed: 0 additions & 44 deletions
This file was deleted.

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@
223223
</item>
224224
</item>
225225
<item name="telephone" xsi:type="array">
226-
<item name="validation" xsi:type="array">
227-
<item name="validate-phoneStrict" xsi:type="number">0</item>
228-
</item>
229226
<item name="config" xsi:type="array">
230227
<item name="tooltip" xsi:type="array">
231228
<item name="description" xsi:type="string" translate="true">For delivery questions.</item>

app/code/Magento/Customer/Test/Mftf/Data/AddressData.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<item>Bld D</item>
2020
</array>
2121
<data key="company">Magento</data>
22-
<data key="telephone">123-456-7890</data>
22+
<data key="telephone">1234568910</data>
2323
<data key="fax">1234568910</data>
2424
<data key="postcode">78729</data>
2525
<data key="city">Austin</data>
@@ -172,7 +172,7 @@
172172
<data key="city">London</data>
173173
<data key="postcode">SE1 7RW</data>
174174
<data key="country_id">GB</data>
175-
<data key="telephone">444-444-4444</data>
175+
<data key="telephone">444-44-444-44</data>
176176
</entity>
177177
<entity name="US_Address_Utah" type="address">
178178
<data key="firstname">John</data>
@@ -227,7 +227,7 @@
227227
<data key="firstname">John</data>
228228
<data key="lastname">Doe</data>
229229
<data key="company">Magento</data>
230-
<data key="telephone">888-777-7890</data>
230+
<data key="telephone">0123456789-02134567</data>
231231
<array key="street">
232232
<item>172, Westminster Bridge Rd</item>
233233
<item>7700 xyz street</item>
@@ -305,7 +305,7 @@
305305
<data key="firstname">Jane</data>
306306
<data key="lastname">Miller</data>
307307
<data key="company">Magento</data>
308-
<data key="telephone">123-456-7899</data>
308+
<data key="telephone">44 20 7123 1234</data>
309309
<array key="street">
310310
<item>1 London Bridge Street</item>
311311
</array>

app/code/Magento/LoginAsCustomer/Model/ResourceModel/GetAuthenticationDataBySecret.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
namespace Magento\LoginAsCustomer\Model\ResourceModel;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\App\ResourceConnection;
11-
use Magento\Framework\Stdlib\DateTime\DateTime;
12+
use Magento\Framework\Encryption\EncryptorInterface;
1213
use Magento\Framework\Exception\LocalizedException;
14+
use Magento\Framework\Stdlib\DateTime\DateTime;
1315
use Magento\LoginAsCustomerApi\Api\ConfigInterface;
1416
use Magento\LoginAsCustomerApi\Api\Data\AuthenticationDataInterface;
1517
use Magento\LoginAsCustomerApi\Api\Data\AuthenticationDataInterfaceFactory;
@@ -40,22 +42,30 @@ class GetAuthenticationDataBySecret implements GetAuthenticationDataBySecretInte
4042
*/
4143
private $authenticationDataFactory;
4244

45+
/**
46+
* @var EncryptorInterface
47+
*/
48+
private $encryptor;
49+
4350
/**
4451
* @param ResourceConnection $resourceConnection
4552
* @param DateTime $dateTime
4653
* @param ConfigInterface $config
4754
* @param AuthenticationDataInterfaceFactory $authenticationDataFactory
55+
* @param EncryptorInterface|null $encryptor
4856
*/
4957
public function __construct(
5058
ResourceConnection $resourceConnection,
5159
DateTime $dateTime,
5260
ConfigInterface $config,
53-
AuthenticationDataInterfaceFactory $authenticationDataFactory
61+
AuthenticationDataInterfaceFactory $authenticationDataFactory,
62+
?EncryptorInterface $encryptor = null
5463
) {
5564
$this->resourceConnection = $resourceConnection;
5665
$this->dateTime = $dateTime;
5766
$this->config = $config;
5867
$this->authenticationDataFactory = $authenticationDataFactory;
68+
$this->encryptor = $encryptor ?? ObjectManager::getInstance()->get(EncryptorInterface::class);
5969
}
6070

6171
/**
@@ -71,9 +81,11 @@ public function execute(string $secret): AuthenticationDataInterface
7181
$this->dateTime->gmtTimestamp() - $this->config->getAuthenticationDataExpirationTime()
7282
);
7383

84+
$hash = $this->encryptor->hash($secret);
85+
7486
$select = $connection->select()
7587
->from(['main_table' => $tableName])
76-
->where('main_table.secret = ?', $secret)
88+
->where('main_table.secret = ?', $hash)
7789
->where('main_table.created_at > ?', $timePoint);
7890

7991
$data = $connection->fetchRow($select);

app/code/Magento/LoginAsCustomer/Model/ResourceModel/SaveAuthenticationData.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
namespace Magento\LoginAsCustomer\Model\ResourceModel;
99

10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\App\ResourceConnection;
11-
use Magento\Framework\Stdlib\DateTime\DateTime;
12+
use Magento\Framework\Encryption\EncryptorInterface;
1213
use Magento\Framework\Math\Random;
14+
use Magento\Framework\Stdlib\DateTime\DateTime;
1315
use Magento\LoginAsCustomerApi\Api\Data\AuthenticationDataInterface;
1416
use Magento\LoginAsCustomerApi\Api\SaveAuthenticationDataInterface;
1517

@@ -18,6 +20,11 @@
1820
*/
1921
class SaveAuthenticationData implements SaveAuthenticationDataInterface
2022
{
23+
/**
24+
* @var EncryptorInterface
25+
*/
26+
private $encryptor;
27+
2128
/**
2229
* @var ResourceConnection
2330
*/
@@ -37,15 +44,18 @@ class SaveAuthenticationData implements SaveAuthenticationDataInterface
3744
* @param ResourceConnection $resourceConnection
3845
* @param DateTime $dateTime
3946
* @param Random $random
47+
* @param EncryptorInterface $encryptor
4048
*/
4149
public function __construct(
4250
ResourceConnection $resourceConnection,
4351
DateTime $dateTime,
44-
Random $random
52+
Random $random,
53+
?EncryptorInterface $encryptor = null
4554
) {
4655
$this->resourceConnection = $resourceConnection;
4756
$this->dateTime = $dateTime;
4857
$this->random = $random;
58+
$this->encryptor = $encryptor ?? ObjectManager::getInstance()->get(EncryptorInterface::class);
4959
}
5060

5161
/**
@@ -57,16 +67,18 @@ public function execute(AuthenticationDataInterface $authenticationData): string
5767
$tableName = $this->resourceConnection->getTableName('login_as_customer');
5868

5969
$secret = $this->random->getRandomString(64);
70+
$hash = $this->encryptor->hash($secret);
6071

6172
$connection->insert(
6273
$tableName,
6374
[
6475
'customer_id' => $authenticationData->getCustomerId(),
6576
'admin_id' => $authenticationData->getAdminId(),
66-
'secret' => $secret,
77+
'secret' => $hash,
6778
'created_at' => $this->dateTime->gmtDate(),
6879
]
6980
);
81+
7082
return $secret;
7183
}
7284
}

app/code/Magento/LoginAsCustomer/Test/Mftf/ActionGroup/AdminLoginAsCustomerLoginFromCustomerPageManualChooseActionGroup.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
</annotations>
1515
<arguments>
1616
<argument name="customerId" type="string"/>
17-
<argument name="storeViewName" type="string" defaultValue="default"/>
17+
<argument name="storeName" type="string" defaultValue="default"/>
1818
</arguments>
1919

2020
<amOnPage url="{{AdminEditCustomerPage.url(customerId)}}" stepKey="gotoCustomerPage"/>
2121
<waitForPageLoad stepKey="waitForCustomerPageLoad"/>
2222
<click selector="{{AdminCustomerMainActionsSection.loginAsCustomer}}" stepKey="clickLoginAsCustomerLink"/>
23-
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Login as Customer: Select Store View" stepKey="seeModal"/>
24-
<see selector="{{AdminConfirmationModalSection.message}}" userInput="Actions taken while in &quot;Login as Customer&quot; will affect actual customer data." stepKey="seeModalMessage"/>
25-
<selectOption selector="{{AdminLoginAsCustomerConfirmationModalSection.storeView}}" userInput="{{storeViewName}}" stepKey="selectStoreView"/>
23+
<see selector="{{AdminConfirmationModalSection.title}}" userInput="Login as Customer: Select Store" stepKey="seeModal"/>
24+
<see selector="{{AdminConfirmationModalSection.message}}" userInput="Actions taken while in &quot;Login as Customer&quot; will affect actual customer data." stepKey="seeModalMessage"/>
25+
<selectOption selector="{{AdminLoginAsCustomerConfirmationModalSection.store}}" userInput="{{storeName}}" stepKey="selectStore"/>
2626
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="clickLogin"/>
2727
<switchToNextTab stepKey="switchToNewTab"/>
2828
<waitForPageLoad stepKey="waitForPageLoad"/>

app/code/Magento/LoginAsCustomer/Test/Mftf/Section/AdminLoginAsCustomerConfirmationModalSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminLoginAsCustomerConfirmationModalSection">
12-
<element name="storeView" type="select" selector="//select[@id='lac-confirmation-popup-store-id']"/>
12+
<element name="store" type="select" selector="//select[@id='lac-confirmation-popup-store-id']"/>
1313
</section>
1414
</sections>

app/code/Magento/LoginAsCustomer/Test/Mftf/Test/AdminLoginAsCustomerAutoDetectionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<test name="AdminLoginAsCustomerAutoDetectionTest">
1212
<annotations>
1313
<features value="Login as Customer"/>
14-
<stories value="Select Store View based on 'Store View To Login In' setting"/>
14+
<stories value="Select Store based on 'Store View To Login In' setting"/>
1515
<title
1616
value="Admin user directly login into customer account with store View To Login In = Auto detection"/>
1717
<description

app/code/Magento/LoginAsCustomer/Test/Mftf/Test/AdminLoginAsCustomerManualChooseStoreCodeInUrlTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<test name="AdminLoginAsCustomerManualChooseStoreCodeInUrlTest" extends="AdminLoginAsCustomerManualChooseTest">
1212
<annotations>
1313
<features value="Login as Customer"/>
14-
<stories value="Select Store View based on 'Store View To Login In' setting"/>
14+
<stories value="Select Store based on 'Store View To Login In' setting"/>
1515
<title
1616
value="Admin user directly login into customer account with store View To Login In = Manual Choose when store code is added to url"/>
1717
<description
@@ -29,8 +29,8 @@
2929
command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}"
3030
stepKey="disableAddStoreCodeToUrls" after="enableLoginAsCustomerAutoDetection"/>
3131
</after>
32-
<actionGroup ref="AssertStorefrontStoreCodeInUrlActionGroup" stepKey="seeCustomStoreCodeInUrl" after="assertCustomStoreView">
33-
<argument name="storeCode" value="{{customStore.code}}"/>
32+
<actionGroup ref="AssertStorefrontStoreCodeInUrlActionGroup" stepKey="seeCustomStoreViewCodeInUrl" after="assertCustomStoreView">
33+
<argument name="storeCode" value="{{customStoreEN.code}}"/>
3434
</actionGroup>
3535
</test>
3636
</tests>

0 commit comments

Comments
 (0)