Skip to content

Commit 8818e30

Browse files
magento-commerce/magento2-login-as-customer#172: Persistent banner is not shown when admin is logged in as customer.
1 parent 229f045 commit 8818e30

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<type name="Magento\Customer\CustomerData\SectionPoolInterface">
10+
<arguments>
11+
<argument name="sectionSourceMap" xsi:type="array">
12+
<item name="loggedAsCustomer" xsi:type="string">Magento\LoginAsCustomerFrontendUi\CustomerData\LoginAsCustomerUi</item>
13+
</argument>
14+
</arguments>
15+
</type>
916
<type name="Magento\Framework\App\ActionInterface">
1017
<plugin name="invalidate_expired_session_plugin"
1118
type="Magento\LoginAsCustomerFrontendUi\Plugin\InvalidateExpiredSessionPlugin"/>

app/code/Magento/LoginAsCustomerFrontendUi/view/frontend/web/js/view/loginAsCustomer.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55

66
define([
77
'jquery',
8+
'underscore',
89
'uiComponent',
910
'Magento_Customer/js/customer-data',
1011
'mage/translate'
11-
], function ($, Component, customer) {
12+
], function ($, _, Component, customer) {
1213
'use strict';
1314

1415
return Component.extend({
@@ -63,8 +64,8 @@ define([
6364

6465
if (this.fullname !== undefined && this.websiteName !== undefined) {
6566
this.notificationText($.mage.__('You are connected as <strong>%1</strong> on %2')
66-
.replace('%1', this.fullname)
67-
.replace('%2', this.websiteName));
67+
.replace('%1', _.escape(this.fullname))
68+
.replace('%2', _.escape(this.websiteName)));
6869
}
6970
}
7071
});

0 commit comments

Comments
 (0)