- $args = '';
- $attr = $openid->getAttributes();
- if (is_array($attr) && count($attr)) {
- foreach ($attr as $k => $v) {
- if ($k === 'namePerson/friendly') {
- $nick = notags(trim($v));
- }
- if($k === 'namePerson/first') {
- $first = notags(trim($v));
- }
- if($k === 'namePerson') {
- $args .= '&username=' . urlencode(notags(trim($v)));
- }
- if ($k === 'contact/email') {
- $args .= '&email=' . urlencode(notags(trim($v)));
- }
- if ($k === 'media/image/aspect11') {
- $photosq = bin2hex(trim($v));
- }
- if ($k === 'media/image/default') {
- $photo = bin2hex(trim($v));
- }
- }
- }
- if ($nick) {
- $args .= '&nickname=' . urlencode($nick);
+ Session::set('openid_attributes', $openid->getAttributes());
+ Session::set('openid_identity', $authid);
+
+ // Detect the server URL
+ $open_id_obj = new LightOpenID($a->getHostName());
+ $open_id_obj->identity = $authid;
+ Session::set('openid_server', $open_id_obj->discover($open_id_obj->identity));
+
+ if (intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED) {
+ notice(L10n::t('Account not found. Please login to your existing account to add the OpenID to it.'));
+ } else {
+ notice(L10n::t('Account not found. Please register a new account or login to your existing account to add the OpenID to it.'));