diff --git a/app/code/community/Inchoo/LoginAsCustomer/controllers/Adminhtml/Inchoo/LoginAsCustomerController.php b/app/code/community/Inchoo/LoginAsCustomer/controllers/Adminhtml/Inchoo/LoginAsCustomerController.php index 4bcf797..b05223a 100644 --- a/app/code/community/Inchoo/LoginAsCustomer/controllers/Adminhtml/Inchoo/LoginAsCustomerController.php +++ b/app/code/community/Inchoo/LoginAsCustomer/controllers/Adminhtml/Inchoo/LoginAsCustomerController.php @@ -32,6 +32,12 @@ */ class Inchoo_LoginAsCustomer_Adminhtml_Inchoo_LoginAsCustomerController extends Mage_Adminhtml_Controller_Action { + + protected function _isAllowed() + { + return Mage::getSingleton('admin/session')->isLoggedIn(); + } + public function indexAction() { $this->loadLayout()->_setActiveMenu('sales/inchoo_loginAsCustomer'); @@ -49,11 +55,20 @@ public function gridAction() public function loginAction() { $info = Mage::helper('core')->encrypt(serialize(array( - 'website_id' => $this->getRequest()->getParam('website_id'), - 'customer_id' => $this->getRequest()->getParam('customer_id'), - 'timestamp' => time(), - ))); + 'website_id' => $this->getRequest()->getParam('website_id'), + 'customer_id' => $this->getRequest()->getParam('customer_id'), + 'timestamp' => time(), + ))); + + $store = Mage::app()->getWebsite($this->getRequest()->getParam('website_id'))->getDefaultStore(); + + $args = array( + 'loginAsCustomer' => base64_encode($info), + '_store' => $store, + ); + + $url = Mage::getModel('core/url')->getUrl('inchoo_loginAsCustomer/customer/login', $args); - $this->_redirectUrl(Mage::app()->getWebsite($this->getRequest()->getParam('website_id'))->getConfig('web/unsecure/base_url').'index.php/inchoo_loginAsCustomer/customer/login?loginAsCustomer='.base64_encode($info)); + $this->_redirectUrl($url); } } diff --git a/app/locale/de_DE/Inchoo_LoginAsCustomer.csv b/app/locale/de_DE/Inchoo_LoginAsCustomer.csv new file mode 100644 index 0000000..589295e --- /dev/null +++ b/app/locale/de_DE/Inchoo_LoginAsCustomer.csv @@ -0,0 +1,5 @@ +"Login as Customer","Als Kunde anmelden" +"Login as customer %s (choose a website to log into)","Als Kunde anmelden (wählen Sie eine Webseite, in der Sie sich anmelden wollen)" +"Website Name","Webseite Name" +"Edit Website","Bearbeite Webseite" +"Share Customer Accounts option is set to Per Website. You are trying to login as customer from website %d into website %s. This action is not allowed.","Kundenkonten verteilen ist eingestellt auf pro Webseite. Sie versuchen sich von der Webseite %d auf der Website %s anzumelden. Dieses ist leider nicht möglich." \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b597f1c --- /dev/null +++ b/composer.json @@ -0,0 +1,9 @@ +{ + "name": "inchoo/loginascustomer", + "type": "magento-module", + "description": "login as customer from backend", + "homepage": "https://github.com/ajzele/Inchoo_LoginAsCustomer", + "require": { + "magento-hackathon/magento-composer-installer": "*" + } +} \ No newline at end of file diff --git a/modman b/modman new file mode 100644 index 0000000..0de3ad3 --- /dev/null +++ b/modman @@ -0,0 +1,4 @@ +app/etc/modules/Inchoo_LoginAsCustomer.xml app/etc/modules/Inchoo_LoginAsCustomer.xml +app/code/community/Inchoo/LoginAsCustomer/ app/code/community/Inchoo/LoginAsCustomer/ +app/locale/pt_BR/Inchoo_LoginAsCustomer.csv app/locale/pt_BR/Inchoo_LoginAsCustomer.csv +app/locale/de_DE/Inchoo_LoginAsCustomer.csv app/locale/de_DE/Inchoo_LoginAsCustomer.csv \ No newline at end of file