Add some AX vars to openid server.
This commit is contained in:
parent
02a58dc5b0
commit
f2d84608af
39
mod/id.php
39
mod/id.php
@ -49,9 +49,10 @@ function getUserData($handle=null)
|
|||||||
if(! local_channel()) {
|
if(! local_channel()) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
get_app()->page['content'] = login();
|
get_app()->page['content'] = login();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('handle: ' . $handle);
|
// logger('handle: ' . $handle);
|
||||||
|
|
||||||
if($handle) {
|
if($handle) {
|
||||||
$r = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_address = '%s' limit 1",
|
$r = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_address = '%s' limit 1",
|
||||||
@ -64,6 +65,19 @@ function getUserData($handle=null)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! r)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$x = q("select * from account where account_id = %d limit 1",
|
||||||
|
intval($r[0]['channel_account_id'])
|
||||||
|
);
|
||||||
|
if($x)
|
||||||
|
$r[0]['email'] = $x[0]['account_email'];
|
||||||
|
|
||||||
|
$r[0]['firstName'] = ((strpos($r[0]['channel_name'],' ')) ? substr($r[0]['channel_name'],0,strpos($r[0]['channel_name'],' ')) : $r[0]['channel_name']);
|
||||||
|
$r[0]['lastName'] = ((strpos($r[0]['channel_name'],' ')) ? substr($r[0]['channel_name'],strpos($r[0]['channel_name'],' ')+1) : '');
|
||||||
|
|
||||||
|
|
||||||
return $r[0];
|
return $r[0];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -96,26 +110,29 @@ function getUserData($handle=null)
|
|||||||
class MysqlProvider extends LightOpenIDProvider
|
class MysqlProvider extends LightOpenIDProvider
|
||||||
{
|
{
|
||||||
private $attrMap = array(
|
private $attrMap = array(
|
||||||
'namePerson/first' => 'First name',
|
'namePerson/first' => 'First name',
|
||||||
'namePerson/last' => 'Last name',
|
'namePerson/last' => 'Last name',
|
||||||
'namePerson/friendly' => 'Nickname (login)'
|
'namePerson/friendly' => 'Nickname',
|
||||||
|
'contact/internet/email' => 'Email'
|
||||||
);
|
);
|
||||||
|
|
||||||
private $attrFieldMap = array(
|
private $attrFieldMap = array(
|
||||||
'namePerson/first' => 'firstName',
|
'namePerson/first' => 'firstName',
|
||||||
'namePerson/last' => 'lastName',
|
'namePerson/last' => 'lastName',
|
||||||
'namePerson/friendly' => 'login'
|
'namePerson/friendly' => 'channel_address',
|
||||||
|
'contact/internet/email' => 'email'
|
||||||
);
|
);
|
||||||
|
|
||||||
function setup($identity, $realm, $assoc_handle, $attributes)
|
function setup($identity, $realm, $assoc_handle, $attributes)
|
||||||
{
|
{
|
||||||
|
|
||||||
logger('identity: ' . $identity);
|
// logger('identity: ' . $identity);
|
||||||
logger('realm: ' . $realm);
|
// logger('realm: ' . $realm);
|
||||||
logger('assoc_handle: ' . $assoc_handle);
|
// logger('assoc_handle: ' . $assoc_handle);
|
||||||
logger('attributes: ' . print_r($attributes,true));
|
// logger('attributes: ' . print_r($attributes,true));
|
||||||
|
|
||||||
$data = getUserData($assoc_handle);
|
$data = getUserData($assoc_handle);
|
||||||
|
|
||||||
$o .= '<form action="" method="post">'
|
$o .= '<form action="" method="post">'
|
||||||
. '<input type="hidden" name="openid.assoc_handle" value="' . $assoc_handle . '">'
|
. '<input type="hidden" name="openid.assoc_handle" value="' . $assoc_handle . '">'
|
||||||
. '<input type="hidden" name="login" value="' . $_POST['login'] .'">'
|
. '<input type="hidden" name="login" value="' . $_POST['login'] .'">'
|
||||||
|
Reference in New Issue
Block a user