For the OpenID authentication I'm using "PHP OpenID Library" (http://www.janrain.com/openid-enabled). How, with the help of this library, ask for additional information (nickname, email)?
I've got some problems with LightOpenID, when I ask email at yandex LightOpenID-> valid returns false(
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
}
}