简体   繁体   中英

Login User To Magento Via OpenID

If I have already authenticated a user via OpenID, and they are redirected back to Magento, how do I log them in automatically? All I have is their email. What am I missing?

Thanks in advance.

It is answer to question how to login customer in, not to initial big question. I decided to write it here because code formatting is absent in comments.

// $login here is customer email
$customer = Mage::getModel('customer/customer')
    ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
    ->loadByEmail($login);

Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer)
    ->renewSession();

// now redirect user to home page or do something else what you need

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM