I have to call Customer login from from out side of magento setup
Like www.demo.com is my Mage setup
I have one more core php website
when i have login from www.demo.com/core/login.php
needto login magetno setup also.
include ("../app/mage.php"); umask(0); Mage::app(); <form id="login-form" method="post" action="http://127.0.0.1/demo/customer/account/loginPost/"> <input type="hidden" value="<?php echo $fromKey; ?>" name="form_key"> <input type="text" title="Email Address" class="input-text required-entry validate-email" id="email" value="" name="login[username]"> <input type="password" title="Password" id="pass" class="input-text required-entry validate-password" name="login[password]"> <input type="submit" value="login"/>
when i copy from Mage login form.
login is showing error like
Cannot send headers; headers already sent
but user is loged in success.
because of fromkey()
1) i created new form key by
uts redirecting to login page or showign eable cookies.
my Question is
1) how to login from out side
2) why new fromKey() not allowing to me login but when copy login.phml formkey its working. or how to call login form out side.
Solved! Go to Solution.
So, you are doing this how?
I have PHP code to automatically log someone in to Magento, looks something like this.
Mage::app(); Mage::getSingleton('core/session', array('name'=>'frontend')); $session = Mage::getSingleton('customer/session'); $session->login($_POST['EmailAddress'],$_POST['Password']); $session->setCustomerAsLoggedIn($session->getCustomer());
Hi MrBaseball34, Thanks for your Ans,
I have small query
Why when I was used
$fromKey = Mage::getSingleton('core/session')->getFormKey();
Its login is working but its showing fatal error.
I crated my
$newFormkey = Mage::getSingleton('core/session')->setData('_form_key', Mage::helper('core')->getRandomString(16));
$newFormkey its working good no errors.
waht is different btw both formkeys.
why its not working noremal formkey.
We don't use forms for this, it is in an ExpressionEngine plugin. I am not sure how to use the encrypted forms in Magento.