]> git.mxchange.org Git - friendica.git/blobdiff - mod/openid.php
First attemp of api
[friendica.git] / mod / openid.php
index 2e1025692d3a8285eff137a2fc0a7d8589700904..68d7c3fd2a482645ea7e81bd11d49433b21cfdc3 100644 (file)
@@ -70,7 +70,7 @@ function openid_content(&$a) {
                        $_SESSION['page_flags'] = $r[0]['page-flags'];
                        $_SESSION['my_url'] = $a->get_baseurl() . '/profile/' . $r[0]['nickname'];
 
-                       notice( t("Welcome back ") . $r[0]['username'] . EOL);
+                       notice( sprintf( t("Welcome back "), $r[0]['username']) . EOL);
                        $a->user = $r[0];
 
                        if(strlen($a->user['timezone'])) {
@@ -78,8 +78,16 @@ function openid_content(&$a) {
                                $a->timezone = $a->user['timezone'];
                        }
 
-                       $r = q("SELECT * FROM `contact` WHERE `uid` = %s AND `self` = 1 LIMIT 1",
-                               intval($_SESSION['uid']));
+                       $r = q("SELECT `uid`,`username` FROM `user` WHERE `password` = '%s' AND `email` = '%s'",
+                               dbesc($a->user['password']),
+                               dbesc($a->user['email'])
+                       );
+                       if(count($r))
+                               $a->identities = $r;
+
+                       $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+                               intval($_SESSION['uid'])
+                       );
                        if(count($r)) {
                                $a->contact = $r[0];
                                $a->cid = $r[0]['id'];