duanniwu7730 2011-09-15 03:09
浏览 59
已采纳

LightOpenID - 如何从存储的会话中检索电子邮件?

I am storing $lightopenid->identity in a codeigniter session as follows:

            $lightopenid           = new Lightopenid;
            $lightopenid->required = array('contact/email');

            if ($lightopenid->validate()) {

                $google_open_id = $lightopenid->identity;
                $this->session->set_userdata('google_open_id', $google_open_id);
             }

In a separate function in my controller I would like to retrieve the user's email.

            print_r($this->session->userdata('google_open_id'));

will show me the identity link but how do I retrieve the email from it?

Do I need a new instance of lightopenid?

Any suggestions?

  • 写回答

1条回答 默认 最新

  • douquan1953 2011-09-16 16:04
    关注

    You have to store the email in the session. LightOpenID doesn't store anything. You'd have to redo the whole authentication in order to retrieve the email address only from the identity.

    So, something like that:

    if($openid->validate()) {
        $attributes = $openid->getAttributes();
        $this->session->set_userdata('open_id', $openid->identity);
        $this->session->set_userdata('email', $attributes['email']);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器