PHP OpenID geting takma &

0 Cevap php

OpenID kimlik doğrulaması için ben "PHP OpenID Library" kullanıyorum (http://www.janrain.com/openid-enabled). Bu kütüphane yardımıyla, ek bilgi (adı, email) için sormak nasıl?

Ben yandex LightOpenID-> geçerli döner sahte adresine e-posta sorduğunuzda (LightOpenID, ile bazı sorunlar var

class Ncw_OpenID extends LightOpenID
{
    const OPENID_MODE_CANCEL = 'cancel';

    public function __construct()
    {
        parent::__construct();
        $this->required = array('namePerson/friendly', 'contact/email');
        $this->optional = array('contact/email');
        //$this->returnUrl = 'http://' . SITE_URI . '/users/login';
    }

    public function  getAttributes() {
        $attr = parent::getAttributes();
        $newAttr = array();
        foreach ($attr as $key => $value) {
            if (isset(parent::$ax_to_sreg[$key])) $key = parent::$ax_to_sreg[$key];
            $newAttr[$key] = $value;
        }
        return $newAttr;
    }
}

class Users_IndexController extends Zend_Controller_Action
{
    public function loginAction()
    {
        $openIDMode = $this->_request->getParam('openid_mode');
        $openID = new Ncw_OpenID();
        $form = new Users_Form_Login(array('action' => $this->view->url(array(), 'openIDLogin')));

        if (null === $openIDMode) {

            if ($this->_request->isPost() && $form->isValid($_POST)) {
                $openID->identity = $form->getValue('openIDUri');
                $this->_redirect($openID->authUrl());
                exit();
            }
            $this->view->content = $form;
        } elseif (Ncw_OpenID::OPENID_MODE_CANCEL == $openIDMode) {
            $this->view->content = 'Cancel';
        } else {
            if ($openID->validate()) {
                $this->view->content = 'Valid: ' . $openID->identity . ' = ' . var_export($openID->getAttributes(), true);
            } else {
                $this->view->content = 'Not Valid';
            }
            $this->view->content .= $form;
        }
    }

    public function logoutAction()
    {
        // action body
    }
}

0 Cevap