Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}
}
5 changes: 5 additions & 0 deletions app/locale/de_DE/Inchoo_LoginAsCustomer.csv
Original file line number Diff line number Diff line change
@@ -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"
"<i>Share Customer Accounts</i> option is set to <i>Per Website</i>. You are trying to login as customer from website %d into website %s. This action is not allowed.","<i>Kundenkonten verteilen</i> ist eingestellt auf <i>pro Webseite</i>. Sie versuchen sich von der Webseite %d auf der Website %s anzumelden. Dieses ist leider nicht möglich."
9 changes: 9 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": "*"
}
}
4 changes: 4 additions & 0 deletions modman
Original file line number Diff line number Diff line change
@@ -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