Some extra auth_user fixes.
[platal.git] / modules / openid / openid.inc.php
index 5c3cab0..d5f7c5c 100644 (file)
@@ -52,19 +52,9 @@ function get_user_by_alias($x) {
     if (is_null($x)) {
         return null;
     }
-    // TODO such a function should probably be provided in the User class
-    // or at least not here
-    $res = XDB::query('SELECT  u.user_id
-                         FROM  auth_user_md5   AS u
-                   INNER JOIN  auth_user_quick AS q USING(user_id)
-                   INNER JOIN  aliases         AS a ON (a.id = u.user_id AND type != \'homonyme\')
-                        WHERE  u.perms IN(\'admin\', \'user\')
-                          AND  q.emails_alias_pub = \'public\'
-                          AND  a.alias = {?}',
-                               $x);
-    if (list($uid) = $res->fetchOneRow()) {
-        $user = User::getSilent($uid);
-    }
+    global $globals;
+    // Should we check the publicity of the alias?
+    $user = User::getSilent($x . '@' . $globals->mail->alias_dom);
     return $user ? $user : null;
 
 }
@@ -127,4 +117,4 @@ function add_trusted_site($user, $url)
 }
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
-?>
\ No newline at end of file
+?>