aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-12 18:48:32 -0700
committerfriendica <info@friendica.com>2015-03-12 18:48:32 -0700
commitf2d84608af74e66fe6c5d21369cd5d3cfe4803de (patch)
tree86ea3c57df0d818b9083217a87f614adcd59f022
parent02a58dc5b05a39eee9784261c5010c0f1765588f (diff)
downloadvolse-hubzilla-f2d84608af74e66fe6c5d21369cd5d3cfe4803de.tar.gz
volse-hubzilla-f2d84608af74e66fe6c5d21369cd5d3cfe4803de.tar.bz2
volse-hubzilla-f2d84608af74e66fe6c5d21369cd5d3cfe4803de.zip
Add some AX vars to openid server.
-rw-r--r--mod/id.php39
1 files changed, 28 insertions, 11 deletions
diff --git a/mod/id.php b/mod/id.php
index 760a29c01..4a6f5683c 100644
--- a/mod/id.php
+++ b/mod/id.php
@@ -49,9 +49,10 @@ function getUserData($handle=null)
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
get_app()->page['content'] = login();
+ return false;
}
- logger('handle: ' . $handle);
+// logger('handle: ' . $handle);
if($handle) {
$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];
/*
@@ -96,26 +110,29 @@ function getUserData($handle=null)
class MysqlProvider extends LightOpenIDProvider
{
private $attrMap = array(
- 'namePerson/first' => 'First name',
- 'namePerson/last' => 'Last name',
- 'namePerson/friendly' => 'Nickname (login)'
+ 'namePerson/first' => 'First name',
+ 'namePerson/last' => 'Last name',
+ 'namePerson/friendly' => 'Nickname',
+ 'contact/internet/email' => 'Email'
);
private $attrFieldMap = array(
- 'namePerson/first' => 'firstName',
- 'namePerson/last' => 'lastName',
- 'namePerson/friendly' => 'login'
+ 'namePerson/first' => 'firstName',
+ 'namePerson/last' => 'lastName',
+ 'namePerson/friendly' => 'channel_address',
+ 'contact/internet/email' => 'email'
);
function setup($identity, $realm, $assoc_handle, $attributes)
{
- logger('identity: ' . $identity);
- logger('realm: ' . $realm);
- logger('assoc_handle: ' . $assoc_handle);
- logger('attributes: ' . print_r($attributes,true));
+// logger('identity: ' . $identity);
+// logger('realm: ' . $realm);
+// logger('assoc_handle: ' . $assoc_handle);
+// logger('attributes: ' . print_r($attributes,true));
$data = getUserData($assoc_handle);
+
$o .= '<form action="" method="post">'
. '<input type="hidden" name="openid.assoc_handle" value="' . $assoc_handle . '">'
. '<input type="hidden" name="login" value="' . $_POST['login'] .'">'