Praxigento_LoginAs - Version 1.2.2

Version Notes

- Fix redirection failure on disabled "Admin routing compatibility mode for extensions" option (Config / Advanced /
Admin / Security /...);

Download this release

Release Info

Developer Alex Gusev
Extension Praxigento_LoginAs
Version 1.2.2
Comparing to
See all releases


Code changes from version 1.2.0 to 1.2.2

app/code/community/Praxigento/LoginAs/Block/Adminhtml/Redirect.php ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * User: Alex Gusev <alex@flancer64.com>
4
+ */
5
+
6
+ /**
7
+ * Block prints out HTML code directly, without any templates.
8
+ */
9
+ class Praxigento_LoginAs_Block_Adminhtml_Redirect
10
+ extends \Mage_Core_Block_Abstract
11
+ {
12
+
13
+ protected function _toHtml()
14
+ {
15
+ /** @var $authPack Praxigento_LoginAs_Model_Package */
16
+ $authPack = Mage::getSingleton('prxgt_lgas_model/package');
17
+ $url = htmlentities($authPack->getRedirectUrl());
18
+ $formName = Praxigento_LoginAs_Config::REQ_PARAM_LAS_ID;
19
+ $packageId = htmlentities($authPack->getPackageId());
20
+ /** Post file name with login parameters */
21
+ $out = "<html>
22
+ <body>
23
+ <form action=\"$url\" method=\"post\" id=\"login-form\">
24
+ <input type=\"hidden\" name=\"$formName\" id=\"$formName\" value=\"$packageId\"/>
25
+ </form>
26
+ <script type=\"text/javascript\">
27
+ //<![CDATA[
28
+ document.getElementById(\"login-form\").submit();
29
+ //]]>
30
+ </script>
31
+ </body>
32
+ </html>";
33
+ return $out;
34
+ }
35
+
36
+ }
app/code/community/Praxigento/LoginAs/Config.php CHANGED
@@ -50,7 +50,7 @@ class Praxigento_LoginAs_Config
50
  /******************************************************************************************
51
  * Module's config.xml parameters
52
  *****************************************************************************************/
53
- const XMLCFG_ROUTER_ADMIN = 'prxgt_lgas_admin';
54
  const XMLCFG_ROUTER_FRONT = 'prxgt_lgas_front';
55
 
56
  /**
50
  /******************************************************************************************
51
  * Module's config.xml parameters
52
  *****************************************************************************************/
53
+ const XMLCFG_ROUTER_ADMIN = 'adminhtml';
54
  const XMLCFG_ROUTER_FRONT = 'prxgt_lgas_front';
55
 
56
  /**
app/code/community/Praxigento/LoginAs/controllers/LoginController.php CHANGED
@@ -61,6 +61,7 @@ class Praxigento_LoginAs_LoginController extends Mage_Core_Controller_Front_Acti
61
  } else {
62
  /** establish new customer session */
63
  $validatorData = $session->getValidatorData();
 
64
  if ($this->getRequest()->isPost() && ($operatorIp == $validatorData['remote_addr'])) {
65
  try {
66
  /** @var $customer Mage_Customer_Model_Customer */
61
  } else {
62
  /** establish new customer session */
63
  $validatorData = $session->getValidatorData();
64
+ Mage::getSingleton('checkout/session')->setQuote(Mage::getModel('sales/quote'));
65
  if ($this->getRequest()->isPost() && ($operatorIp == $validatorData['remote_addr'])) {
66
  try {
67
  /** @var $customer Mage_Customer_Model_Customer */
app/code/community/Praxigento/LoginAs/controllers/RedirectController.php CHANGED
@@ -52,8 +52,10 @@ class Praxigento_LoginAs_RedirectController extends Mage_Adminhtml_Controller_Ac
52
  $customerName = $customer->getName();
53
  /** define URL to login to customer's website */
54
  $wsId = $customer->getData('website_id');
55
- if (is_null($wsId)) {
56
- $wsId = Mage::app()->getStore()->getWebsiteId();
 
 
57
  }
58
  /** @var $website Mage_Core_Model_Website */
59
  $website = Mage::getModel('core/website')->load($wsId);
@@ -85,7 +87,6 @@ class Praxigento_LoginAs_RedirectController extends Mage_Adminhtml_Controller_Ac
85
  $log->trace("Operator '$operator' is redirected to front from ip '$ip' to login" .
86
  " as customer '$customerName' ($customerId).");
87
  }
88
- $bu = var_export($this->getLayout()->getUpdate()->getHandles(), true);
89
  /** load layout and render blocks */
90
  $this->loadLayout()->renderLayout();
91
  }
52
  $customerName = $customer->getName();
53
  /** define URL to login to customer's website */
54
  $wsId = $customer->getData('website_id');
55
+ if (!$wsId) {
56
+ /* 'null' or '0' - adminhtml */
57
+ $defStoreView = Mage::app()->getDefaultStoreView();
58
+ $wsId = $defStoreView->getWebsiteId();
59
  }
60
  /** @var $website Mage_Core_Model_Website */
61
  $website = Mage::getModel('core/website')->load($wsId);
87
  $log->trace("Operator '$operator' is redirected to front from ip '$ip' to login" .
88
  " as customer '$customerName' ($customerId).");
89
  }
 
90
  /** load layout and render blocks */
91
  $this->loadLayout()->renderLayout();
92
  }
app/code/community/Praxigento/LoginAs/etc/config.xml CHANGED
@@ -23,18 +23,19 @@
23
  <config>
24
  <modules>
25
  <Praxigento_LoginAs>
26
- <version>1.2.0</version>
27
  </Praxigento_LoginAs>
28
  </modules>
29
  <admin>
30
  <routers>
31
- <prxgt_lgas_router>
32
- <use>admin</use>
33
  <args>
34
- <module>Praxigento_LoginAs</module>
35
- <frontName>prxgt_lgas_admin</frontName>
 
 
36
  </args>
37
- </prxgt_lgas_router>
38
  </routers>
39
  </admin>
40
  <adminhtml>
@@ -137,6 +138,11 @@
137
  </layout>
138
  </frontend>
139
  <global>
 
 
 
 
 
140
  <events>
141
  <sales_convert_quote_address_to_order>
142
  <observers>
23
  <config>
24
  <modules>
25
  <Praxigento_LoginAs>
26
+ <version>1.2.2</version>
27
  </Praxigento_LoginAs>
28
  </modules>
29
  <admin>
30
  <routers>
31
+ <adminhtml>
 
32
  <args>
33
+ <modules>
34
+ <!-- LGAS-27 -->
35
+ <Praxigento_LoginAs before="Mage_Adminhtml">Praxigento_LoginAs</Praxigento_LoginAs>
36
+ </modules>
37
  </args>
38
+ </adminhtml>
39
  </routers>
40
  </admin>
41
  <adminhtml>
138
  </layout>
139
  </frontend>
140
  <global>
141
+ <blocks>
142
+ <prxgt_lgas_block>
143
+ <class>Praxigento_LoginAs_Block</class>
144
+ </prxgt_lgas_block>
145
+ </blocks>
146
  <events>
147
  <sales_convert_quote_address_to_order>
148
  <observers>
app/code/community/Praxigento/LoginAs/etc/release.txt CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  1.2.0:
2
  - Controllers fix (_isAllowed);
3
  - Auto installation with sample data generation in development version;
1
+ 1.2.2:
2
+ - Fix redirection failure on disabled "Admin routing compatibility mode for extensions" option (Config / Advanced /
3
+ Admin / Security /...);
4
+
5
+ 1.2.1:
6
+ - https://magento.stackexchange.com/questions/15029/login-as-customer-problem
7
+
8
  1.2.0:
9
  - Controllers fix (_isAllowed);
10
  - Auto installation with sample data generation in development version;
app/design/adminhtml/default/default/layout/prxgt/lgas/adminhtml_layout.xml CHANGED
@@ -26,7 +26,9 @@
26
  <!-- ... [nmmlm_core_router]_[sync_products]_[index] -->
27
  <!-- ... Nmmlm/Core/controllers/Sync/ProductsController.php:indexAction() -->
28
  <!-- ****************************************************************************** -->
29
- <prxgt_lgas_router_redirect_index>
30
- <block type="adminhtml/template" name="root" template="prxgt/lgas/redirect.phtml"/>
31
- </prxgt_lgas_router_redirect_index>
 
 
32
  </layout>
26
  <!-- ... [nmmlm_core_router]_[sync_products]_[index] -->
27
  <!-- ... Nmmlm/Core/controllers/Sync/ProductsController.php:indexAction() -->
28
  <!-- ****************************************************************************** -->
29
+ <adminhtml_redirect_index>
30
+ <!--block prints out HTML code directly, without any templates. -->
31
+ <block type="prxgt_lgas_block/adminhtml_redirect" name="root"/>
32
+ </adminhtml_redirect_index>
33
+
34
  </layout>
app/design/adminhtml/default/default/template/prxgt/lgas/redirect.phtml DELETED
@@ -1,49 +0,0 @@
1
- <?php
2
- /**
3
- * Copyright (c) 2013, Praxigento
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
7
- * following conditions are met:
8
- * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following
9
- * disclaimer.
10
- * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
11
- * following disclaimer in the documentation and/or other materials provided with the distribution.
12
- *
13
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
14
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
19
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20
- */
21
- ?>
22
- <?php
23
- /**
24
- * Customer login form - auto redirect to account controller with custom LoginAs action.
25
- *
26
- * @see Nmmlm_Core_Block_Default
27
- */
28
- ?>
29
- <?php
30
- /** @var $this Mage_Adminhtml_Block_Template */
31
- /** @var $authPack Praxigento_LoginAs_Model_Package */
32
- $authPack = Mage::getSingleton('prxgt_lgas_model/package');
33
- ?>
34
- <html>
35
- <body>
36
- <form action="<?php echo htmlentities($authPack->getRedirectUrl()) ?>"
37
- method="post" id="login-form">
38
- <?php /** Post file name with login parameters */ ?>
39
- <input type="hidden" name="<?php echo Praxigento_LoginAs_Config::REQ_PARAM_LAS_ID ?>"
40
- id="<?php echo Praxigento_LoginAs_Config::REQ_PARAM_LAS_ID ?>"
41
- value="<?php echo htmlentities($authPack->getPackageId()) ?>"/>
42
- </form>
43
- <script type="text/javascript">
44
- //<![CDATA[
45
- document.getElementById("login-form").submit();
46
- //]]>
47
- </script>
48
- </body>
49
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,19 +1,19 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Praxigento_LoginAs</name>
4
- <version>1.2.0</version>
5
  <stability>stable</stability>
6
  <license>Apache Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Login as Customer by Praxigento</summary>
10
  <description>Allows store manager to login as a customer right from admin panel. No need for master password.</description>
11
- <notes>- Controllers fix (_isAllowed);&#xD;
12
- - Auto installation with sample data generation in development version;</notes>
13
  <authors><author><name>Alex Gusev</name><user>praxigento</user><email>support@praxigento.com</email></author></authors>
14
- <date>2015-08-12</date>
15
- <time>10:26:41</time>
16
- <contents><target name="magecommunity"><dir name="Praxigento"><dir name="LoginAs"><file name="Config.php" hash="5b9cea206028791a29e175b74b5a226a"/><dir name="Helper"><file name="Data.php" hash="4984b63d05e75a800bed82ea1c5e081b"/></dir><dir name="Model"><file name="Logger.php" hash="a55c0ab3225d571005bc4a488f1fd8ff"/><file name="Observer.php" hash="0704bf3aa563d3ff45f68d88708f59c5"/><file name="Package.php" hash="b9714c664553936faebe2a60090f13f7"/></dir><dir name="Test"><file name="Config_Test.php" hash="5429136647bb5729f640f4ea83c1a805"/><dir name="Model"><file name="Logger_Test.php" hash="59e19092bfab28f026ee68f0da5e3f9e"/></dir><file name="phpunit.bootstrap.php" hash="6d6cdbe1dc9f6d6ea75cf371e784988b"/><file name="phpunit.dist.xml" hash="34b1bc2d5936ebfdf7fd51af87691ed1"/></dir><dir name="controllers"><file name="LoginController.php" hash="177024a4886a39375acac24db6bf0cb3"/><file name="RedirectController.php" hash="c3638f19f8309ed428c451526a78111e"/></dir><dir name="etc"><file name="config.xml" hash="59f4d23cda0764ed7c24bbccbe68f564"/><file name="release.txt" hash="8c194a0e7c393ad6ce7178732ba3cef3"/><file name="system.xml" hash="6e09ca027dd76b33449383d9065d7f7b"/></dir><dir name="sql"><dir name="prxgt_lgas_setup"><file name="mysql4-install-1.0.0.php" hash="fd1c7b0979041dc4b6cdf29c0a3beb76"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="prxgt"><dir name="lgas"><file name="adminhtml_layout.xml" hash="0376174d102d76508fb6c0d87095128e"/></dir></dir></dir><dir name="template"><dir name="prxgt"><dir name="lgas"><file name="redirect.phtml" hash="e56d2d6102ed94c58c1db71e6454a48a"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="prxgt"><dir name="lgas"><file name="frontend_layout.xml" hash="61fb35e960abce103d63a1b9eafd0bbd"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><dir name="prxgt"><dir name="lgas"><file name="prxgt_lgas.csv" hash="d5eb322c09140891fc56de3e784389cb"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Praxigento_LoginAs.xml" hash="bbff13b9b95dfa4d1dd28bd2e25f74a3"/></dir></target></contents>
17
  <compatible/>
18
- <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
19
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Praxigento_LoginAs</name>
4
+ <version>1.2.2</version>
5
  <stability>stable</stability>
6
  <license>Apache Software License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Login as Customer by Praxigento</summary>
10
  <description>Allows store manager to login as a customer right from admin panel. No need for master password.</description>
11
+ <notes>- Fix redirection failure on disabled "Admin routing compatibility mode for extensions" option (Config / Advanced /&#xD;
12
+ Admin / Security /...);</notes>
13
  <authors><author><name>Alex Gusev</name><user>praxigento</user><email>support@praxigento.com</email></author></authors>
14
+ <date>2017-06-27</date>
15
+ <time>13:37:57</time>
16
+ <contents><target name="magecommunity"><dir name="Praxigento"><dir name="LoginAs"><dir name="Block"><dir name="Adminhtml"><file name="Redirect.php" hash="75c8a42b561ea4d9979a61ec560a2ac1"/></dir></dir><file name="Config.php" hash="33f79eeda543e9db4c1fa3e28843000c"/><dir name="Helper"><file name="Data.php" hash="4984b63d05e75a800bed82ea1c5e081b"/></dir><dir name="Model"><file name="Logger.php" hash="a55c0ab3225d571005bc4a488f1fd8ff"/><file name="Observer.php" hash="0704bf3aa563d3ff45f68d88708f59c5"/><file name="Package.php" hash="b9714c664553936faebe2a60090f13f7"/></dir><dir name="Test"><file name="Config_Test.php" hash="5429136647bb5729f640f4ea83c1a805"/><dir name="Model"><file name="Logger_Test.php" hash="59e19092bfab28f026ee68f0da5e3f9e"/></dir><file name="phpunit.bootstrap.php" hash="6d6cdbe1dc9f6d6ea75cf371e784988b"/><file name="phpunit.dist.xml" hash="34b1bc2d5936ebfdf7fd51af87691ed1"/></dir><dir name="controllers"><file name="LoginController.php" hash="a8b5c2ffbc239027632a89d24745fd08"/><file name="RedirectController.php" hash="346460320c958f24e61cd753c8040b08"/></dir><dir name="etc"><file name="config.xml" hash="a12c181b5ed5d17594fe3fa1a6f440b5"/><file name="release.txt" hash="ed583effb1b0fec2abad990af12934ce"/><file name="system.xml" hash="6e09ca027dd76b33449383d9065d7f7b"/></dir><dir name="sql"><dir name="prxgt_lgas_setup"><file name="mysql4-install-1.0.0.php" hash="fd1c7b0979041dc4b6cdf29c0a3beb76"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="prxgt"><dir name="lgas"><file name="adminhtml_layout.xml" hash="b2d89385f46854c6c8b70f3217e3061e"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="prxgt"><dir name="lgas"><file name="frontend_layout.xml" hash="61fb35e960abce103d63a1b9eafd0bbd"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Praxigento_LoginAs.xml" hash="bbff13b9b95dfa4d1dd28bd2e25f74a3"/></dir></target><target name="magelocale"><dir name="en_US"><dir name="prxgt"><dir name="lgas"><file name="prxgt_lgas.csv" hash="d5eb322c09140891fc56de3e784389cb"/></dir></dir></dir></target></contents>
17
  <compatible/>
18
+ <dependencies><required><php><min>5.0.0</min><max>8.0.0</max></php></required></dependencies>
19
  </package>