php - Log in using _forward method to AccountController Magento -
php - Log in using _forward method to AccountController Magento -
i trying magento log me in through form built using _forward() method used pass info proper controller. however, not working. can't tell if right info getting passed controller. logging variables, can see info there (username, hashed password, if business relationship exists, etc.). magento documentation, calling method properly, right parameters.
is there step missing?
here code , how works:
function customerlogin() { var email = jquery('#login-email').val(); var password = jquery('#login-password').val(); jquery.post("orderkickoff/login/login", { 'login[username]': email, 'login[password]': password } ); } this jquery on front end end gets email , password , posts info controller. setting break points, can see controller getting called properly, , info there.
class namespace_orderkickoff_logincontroller extends mage_core_controller_front_action { public function loginaction() { //if client not logged in if(!mage::getsingleton('customer/session')->isloggedin()) { // email , load client id $login = $this->getrequest()->getpost('login'); $email = $login['username']; $customer = mage::getmodel('customer/customer')->setwebsiteid(mage::app()->getstore()->getwebsiteid())->loadbyemail($email); $quote = mage::getsingleton('checkout/cart')->getquote(); //if client exists, log them in forwarding loginpost if($customer->getid()) { // create client log in $mysession = mage::getsingleton('customer/session'); $mysession->setbeforeauthurl(mage::geturl('customer/account/index')); $mysession->setafterauthurl(mage::geturl('customer/account/index')); $this->_forward('loginpost','account','customer'); } else { mage::log("there no client email"); } } $this->_redirect('customer/account/index'); return; } } this controller can see gets customers session, , attempts forwards info controller accountcontroller , phone call loginpost function in order log user in.
this process failing. step through , homecoming function, nil happens. there no redirect, page stays there. can't figure out why not logging me in , redirecting me.
can tell me doing wrong?
let me know if need more information.
thanks!
php magento login controller
Comments
Post a Comment