From 6f51b4a2ce1b7945ca5b02c5a00a701eb985c3f0 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 17 Dec 2011 15:55:57 -0500 Subject: fixed issues preventing account creation --- classes/ElggOpenIDConsumer.php | 48 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'classes/ElggOpenIDConsumer.php') diff --git a/classes/ElggOpenIDConsumer.php b/classes/ElggOpenIDConsumer.php index 6e6828e1c..864e47d41 100644 --- a/classes/ElggOpenIDConsumer.php +++ b/classes/ElggOpenIDConsumer.php @@ -6,6 +6,7 @@ class ElggOpenIDConsumer { protected $provider; + protected $username; protected $returnURL; protected $store; @@ -35,6 +36,15 @@ class ElggOpenIDConsumer { $this->provider = $provider; } + /** + * Set the OpenID username + * + * @param string $username + */ + public function setUsername($username) { + $this->username = $username; + } + /** * Set the return URL * @@ -119,11 +129,39 @@ class ElggOpenIDConsumer { */ protected function getProviderURL() { $url = null; - switch ($this->provider) { + $provider = $this->provider; + $username = $this->username; + switch ($provider) { case 'google': $url = 'https://www.google.com/accounts/o8/id'; break; + case 'yahoo': + $url = 'https://me.yahoo.com/'; + break; + case 'blogger': + $url = "http://$username.blogspot.com/"; + break; + case 'wordpress': + $url = ""; + break; + case 'aol': + $url = "http://openid.aol.com/$username"; + break; + case 'verisign': + $url = "http://username.pip.verisignlabs.com/"; + break; + case 'myopenid': + $url = 'https://myopenid.com/'; + break; + case 'myspace': + $url = 'https://api.myspace.com/openid'; + break; default: + $params = array( + 'provider' => $provider, + 'username' => $username, + ); + $url = elgg_trigger_plugin_hook('set', 'openid_client:url', $params); break; } @@ -199,7 +237,7 @@ class ElggOpenIDConsumer { $data = $this->extractUserData($sreg, $ax); $data['openid_identifier'] = $response->getDisplayIdentifier(); - return data; + return $data; } /** @@ -217,7 +255,7 @@ class ElggOpenIDConsumer { $data['email'] = $sreg['email']; } if (isset($ax['http://axschema.org/contact/email'])) { - $data['email'] = $ax['http://axschema.org/contact/email']; + $data['email'] = $ax['http://axschema.org/contact/email'][0]; } // display name @@ -225,10 +263,10 @@ class ElggOpenIDConsumer { $data['name'] = $sreg['fullname']; } if (isset($ax['http://axschema.org/namePerson/first'])) { - $data['name'] = $ax['http://axschema.org/namePerson/first']; + $data['name'] = $ax['http://axschema.org/namePerson/first'][0]; } if (isset($ax['http://axschema.org/namePerson/last'])) { - $data['name'] .= ' ' . $ax['http://axschema.org/namePerson/last']; + $data['name'] .= ' ' . $ax['http://axschema.org/namePerson/last'][0]; $data['name'] = trim($data['name']); } -- cgit v1.2.3