Renames domain value for users loging with their hruid. Ensures the rigth username...
authorStéphane Jacob <sj@m4x.org>
Fri, 18 Mar 2011 21:38:40 +0000 (22:38 +0100)
committerStéphane Jacob <sj@m4x.org>
Sun, 20 Mar 2011 23:06:45 +0000 (00:06 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/xorgsession.php
plugins/insert.getUserName.php
templates/core/password_prompt.tpl
templates/platal/password.tpl
templates/xnet/login.tpl

index 25ade0d..400f809 100644 (file)
@@ -148,7 +148,7 @@ class XorgSession extends PlSession
                                              WHERE  email = {?} AND type = \'alias_aux\'',
                                            $uname);
                 $loginType = 'uid';
-            } else if (Post::s('domain') == "ax") {
+            } else if (Post::s('domain') == 'hruid') {
                 $login = $uname;
                 $loginType = 'hruid';
             } else {
index e8172fe..ce34a96 100644 (file)
@@ -28,15 +28,22 @@ function smarty_insert_getUsername()
         return '';
     }
 
-    if (Cookie::v('domain', 'login') != 'alias') {
+    $domain = Cookie::v('domain', 'login');
+    if ($domain == 'hruid') {
+        return XDB::fetchOneCell('SELECT  hruid
+                                    FROM  accounts
+                                   WHERE  uid = {?}',
+                                 $id);
+    } elseif ($domain == 'alias') {
         return XDB::fetchOneCell('SELECT  email
                                     FROM  email_source_account
-                                   WHERE  uid = {?} AND type != \'alias_aux\' AND FIND_IN_SET(\'bestalias\', flags)',
+                                   WHERE  uid = {?} AND type = \'alias_aux\'',
                                  $id);
     } else {
         return XDB::fetchOneCell('SELECT  email
                                     FROM  email_source_account
-                                   WHERE  uid = {?} AND type = \'alias_aux\'',
+                                   WHERE  uid = {?} AND type != \'alias_aux\'
+                                ORDER BY  NOT FIND_IN_SET(\'bestalias\', flags), MIN(email)',
                                  $id);
     }
 
index a7e3a6b..6975a2c 100644 (file)
@@ -56,7 +56,7 @@
           <option value="alias" {if t($smarty.cookies.ORGdomain) && $smarty.cookies.ORGdomain eq "alias"}selected="selected"{/if}>
             @ {#globals.mail.alias_dom#} / {#globals.mail.alias_dom2#}
           </option>
-          <option value="ax" {if t($smarty.cookies.ORGdomain) && $smarty.cookies.ORGdomain eq "ax"}selected="selected"{/if}>
+          <option value="hruid" {if t($smarty.cookies.ORGdomain) && $smarty.cookies.ORGdomain eq "ax"}selected="selected"{/if}>
             Identifiant
           </option>
         </select>
index 02cdee2..94dd077 100644 (file)
@@ -68,7 +68,7 @@
         <td>
           <input type="hidden" name="username" value="{$hruid}" />
           <input type="hidden" name="password" value="" />
-          <input type="hidden" name="domain" value="ax" />
+          <input type="hidden" name="domain" value="hruid" />
         </td>
         <td {popup caption='Connexion permanente' width='300' text='Décocher cette case pour que le site oublie ce navigateur.<br />
           Il est conseillé de décocher la case si cette machine n\'est pas <b>strictement</b> personnelle'} colspan="2">
index f92b8cb..749c243 100644 (file)
@@ -28,7 +28,7 @@
       <td class="titre">Identifiant&nbsp;:</td>
       <td>
         <input type="text" name="username" />
-        <input type="hidden" name="domain" value="ax" />
+        <input type="hidden" name="domain" value="hruid" />
       </td>
     </tr>
     <tr>