Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过OpenID将用户登录到Magento_Php_Magento_Openid - Fatal编程技术网

Php 通过OpenID将用户登录到Magento

Php 通过OpenID将用户登录到Magento,php,magento,openid,Php,Magento,Openid,如果我已经通过OpenID验证了一个用户,并且他们被重定向回Magento,我如何自动登录他们?我只有他们的电子邮件。我错过了什么 提前谢谢 这是如何登录客户的问题的答案,而不是最初的大问题。我决定写在这里,因为注释中没有代码格式 // $login here is customer email $customer = Mage::getModel('customer/customer') ->setWebsiteId(Mage::app()->getStore()->

如果我已经通过OpenID验证了一个用户,并且他们被重定向回Magento,我如何自动登录他们?我只有他们的电子邮件。我错过了什么


提前谢谢

这是如何登录客户的问题的答案,而不是最初的大问题。我决定写在这里,因为注释中没有代码格式

// $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

请详细说明。您是否编写了自己的模块,该模块应该通过开放ID登录用户?是的,我正在编写自己的模块。好的,所以您有一个回调页面,用户在登录后将被开放ID提供商重定向到该页面。在该页面上,您有来自开放id提供商的用户电子邮件和身份验证令牌。您需要具有两列的附加表-身份验证令牌和用户id。您的模块应该查看此表,如果在其中找到令牌-登录用户,否则创建新客户。您知道如何登录客户并使用Mage_customer_Model_customer Model创建新客户吗?不知道。这是我不知道的部分。我知道如何创建客户,但我不知道如何登录客户。工作完美!非常感谢你!你帮我省了几个小时的工作!