aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-18 23:51:45 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-18 23:51:45 +0200
commitb255e81e31bf7925c37352bf608c48f3a897a4ef (patch)
tree28eaae9d7d2aa2d6f1e74fec9a79042b3f996aed
parenteaf0573ebdcca11a984f4f98577ca77a6c63654e (diff)
downloadphorkie-b255e81e31bf7925c37352bf608c48f3a897a4ef.tar.gz
phorkie-b255e81e31bf7925c37352bf608c48f3a897a4ef.zip
read full name from Yahoo! OpenID
-rw-r--r--www/login.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/www/login.php b/www/login.php
index bba7c99..77e3953 100644
--- a/www/login.php
+++ b/www/login.php
@@ -59,13 +59,14 @@ if (isset($_POST['openid_url'])) {
$sreg->set('required', 'email,fullname');
$authRequest->addExtension($sreg);
- // AX
+ // AX, http://stackoverflow.com/a/7657061/282601
$ax = new \OpenID_Extension_AX(\OpenID_Extension::REQUEST);
$ax->set('type.email', 'http://axschema.org/contact/email');
$ax->set('type.firstname', 'http://axschema.org/namePerson/first');
$ax->set('type.lastname', 'http://axschema.org/namePerson/last');
+ $ax->set('type.fullname', 'http://axschema.org/namePerson');
$ax->set('mode', 'fetch_request');
- $ax->set('required', 'email,firstname,lastname');
+ $ax->set('required', 'email,firstname,lastname,fullname');
$authRequest->addExtension($ax);
$url = $authRequest->getAuthorizeURL();
@@ -140,6 +141,12 @@ $name = isset($openid['openid.ext1.value.firstname'])
$name = isset($openid['openid.sreg.fullname']) && !isset($name)
? $openid['openid.sreg.fullname']
: $name;
+$name = isset($openid['openid.ax.value.fullname'])
+ && isset($openid['openid.ax.type.fullname'])
+ && $openid['openid.ax.type.fullname'] == 'http://axschema.org/namePerson'
+ && !isset($name)
+ ? $openid['openid.ax.value.fullname']
+ : $name;
$_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR'];
$_SESSION['identity'] = $openid['openid.identity'];