Fix pending NL issue retrieval
[platal.git] / classes / xorgsession.php
index c7a5afd..b8980e1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -208,7 +208,7 @@ class XorgSession extends PlSession
         }
 
         // Loads uid and hruid into the session for developement conveniance.
-        $_SESSION = array_merge($_SESSION, array('uid' => $user->id(), 'hruid' => $user->hruid, 'token' => $user->token));
+        $_SESSION = array_merge($_SESSION, array('uid' => $user->id(), 'hruid' => $user->hruid, 'token' => $user->token, 'user' => $user));
 
         // Starts the session's logger, and sets up the permanent cookie.
         if (S::suid()) {
@@ -261,10 +261,9 @@ class XorgSession extends PlSession
     public function tokenAuth($login, $token)
     {
         $res = XDB::query('SELECT  a.uid, a.hruid
-                             FROM  aliases  AS l
-                       INNER JOIN  accounts AS a ON (l.uid = a.uid AND a.state = \'active\')
-                            WHERE  a.token = {?} AND l.alias = {?} AND l.type != \'homonyme\'',
-                           $token, $login);
+                             FROM  accounts AS a
+                            WHERE  a.token = {?} AND a.hruid = {?} AND a.state = \'active\'',
+                          $token, $login);
         if ($res->numRows() == 1) {
             return new User(null, $res->fetchOneAssoc());
         }