aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/identity.php2
-rw-r--r--mod/openid.php22
2 files changed, 21 insertions, 3 deletions
diff --git a/include/identity.php b/include/identity.php
index d0fffaede..05a228abf 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -1137,7 +1137,7 @@ function get_default_profile_photo($size = 175) {
*/
function is_foreigner($s) {
- return((strpbrk($s,':@')) ? true : false);
+ return((strpbrk($s,'.:@')) ? true : false);
}
diff --git a/mod/openid.php b/mod/openid.php
index d59d671e7..42efeac70 100644
--- a/mod/openid.php
+++ b/mod/openid.php
@@ -59,8 +59,26 @@ function openid_content(&$a) {
goaway(z_root());
// }
- unset($_SESSION['register']);
- $args = '';
+ $r = q("select * from xchan where xchan_hash = '%s' limit 1",
+ dbesc($authid)
+ );
+
+ if($r) {
+ $_SESSION['authenticated'] = 1;
+ $_SESSION['visitor_id'] = $r[0]['xchan_hash'];
+ $_SESSION['my_address'] = $r[0]['xchan_addr'];
+ $arr = array('xchan' => $r[0], 'session' => $_SESSION);
+ call_hooks('magic_auth_openid_success',$arr);
+ $a->set_observer($r[0]);
+ require_once('include/security.php');
+ $a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
+ info(sprintf( t('Welcome %s. Remote authentication successful.'),$r[0]['xchan_name']));
+ logger('mod_openid: remote auth success from ' . $r[0]['xchan_addr']);
+ if($_SESSION['return_url'])
+ goaway($_SESSION['return_url']);
+ goaway(z_root());
+ }
+
$attr = $openid->getAttributes();
if(is_array($attr) && count($attr)) {
foreach($attr as $k => $v) {