[dev] hordeauth imp bug

Vijay Mahrra vijay.mahrra at es.easynet.net
Wed Sep 10 03:27:00 PDT 2003


On Tue, Sep 09, 2003 at 11:01:31AM +0200, Tim Gorter saved a few trees by typing:
: Checking login.inc it seems there is a big confusion in the if statements,
: that even though hordeauth is true, it still shows login parts, and not all
: variables get passed along properly. I started playing with it, but as it
: would take me sometime I have stopped as I cannot right now.
: 
: How is it working for you, are you seeing the above?

this is further patch against imp/templates/login/login.inc which fixes the errors:

1. if the there is no server list for non-hordeauth servers an empty select list
   or additional form elements for entering login details will not appear now 
   (unless $conf['server']['change_server'] = true) 
   e.g. you will now just get the following displayed if you are successfully 
        logged into horde:

   HORDEAUTH_SERVER_LIST   LOGIN_BUTTON 

   instead of:

   HORDEAUTH_SERVER_LIST   LOGIN_BUTTON

   SERVER_LIST (BLANK!)
   USERNAME
   PASSWORD
   LANGUAGE
   LOGIN_BUTTON

2. the tab indexes have been corrected so that each form element is focused in the
   correct order of the elements displayed on screen, regardless of whether we are 
   using a hordeauth server list, and or normal server list or change_server option

vijay
-- 
vijay mahrra                        office: +34 917894652
systems developer/administrator     mobile: +34 679993442
easynet españa (madrid)         http://www.es.easynet.net
-------------- next part --------------
Index: login.inc
===================================================================
RCS file: /repository/imp/templates/login/login.inc,v
retrieving revision 2.133
diff -u -r2.133 login.inc
--- login.inc	9 Sep 2003 03:48:30 -0000	2.133
+++ login.inc	10 Sep 2003 10:04:13 -0000
@@ -48,12 +48,11 @@
 /* Build the <select> widget containing the available languages. */
 if (!$prefs->isLocked('language')) {
     $_SESSION['horde_language'] = NLS::select();
-    $langs = '<select name="new_lang" onchange="selectLang()">';
+    $langs = '';
     foreach ($nls['languages'] as $key => $val) {
         $sel = ($key == $_SESSION['horde_language']) ? ' selected="selected"' : '';
         $langs .= "<option value=\"$key\"$sel>$val</option>";
     }
-    $langs .= '</select>';
 }
 
 // Get a list of applications guests can use, so we can link to the
@@ -169,7 +168,7 @@
     </td>
 </tr>
 <?php endif; ?>
-<?php 
+<?php
   $tabindex = 1;
   if ($conf['server']['server_list'] == 'shown' && !empty($hordeauth_servers_list)): ?>
 <tr>
@@ -177,7 +176,7 @@
   <td class="light" align="left">
     <select tabindex="<?php echo $tabindex++ ?>" name="server_key" onchange="imp_reload();">
       <?php echo $hordeauth_servers_list ?>
-    </select><input type="button" class="button" onclick="imp_reload();" value="<?php echo _("Login") ?>" />
+    </select><input tabindex="<?php echo $tabindex++ ?>" type="button" class="button" onclick="imp_reload();" value="<?php echo _("Login") ?>" />
   </td>
 </tr>
 <?php endif; ?>
@@ -185,11 +184,11 @@
 <tr>
     <td colspan="2"><input type="hidden" name="server" value="<?php echo $server_key ?>" /></td>
 </tr>
-<?php elseif ($conf['server']['server_list'] == 'shown'): ?>
+<?php elseif ($conf['server']['server_list'] == 'shown' && !empty($servers_list)): ?>
 <tr>
     <td align="right" class="light"><b><?php echo _("Server") ?></b></td>
     <td class="light" align="left">
-        <select tabindex="3" name="server"><?php echo $servers_list ?></select>
+        <select tabindex="<?php echo $tabindex++ ?>" name="server"><?php echo $servers_list ?></select>
     </td>
 </tr>
 <?php elseif ($conf['server']['change_server']): ?>
@@ -200,12 +199,12 @@
         <input type="hidden" name="maildomain" value="<?php echo $maildomain_value ?>" />
         <input type="text" tabindex="3" name="server" value="<?php echo Horde::getFormData('server', $server_value) ?>" />
         <?php if ($conf['server']['change_port']): ?>
-        <input type="text" size="4" name="port" tabindex="3" value="<?php echo Horde::getFormData('port', $port_value) ?>" />
+        <input type="text" size="4" name="port" tabindex="<?php echo $tabindex++ ?>" value="<?php echo Horde::getFormData('port', $port_value) ?>" />
         <?php else: ?>
         <input type="hidden" name="port" value="<?php echo $port_value ?>" />
         <?php endif; ?>
         <?php if ($conf['server']['change_protocol']): ?>
-        <select tabindex="3" name="protocol" onchange="updatePort();">
+        <select tabindex="<?php echo $tabindex++ ?>" name="protocol" onchange="updatePort();">
             <?php $protocol = Horde::getFormData('protocol', $protocol_value) ?>
             <option value="imap"<?php if ($protocol == 'imap') echo ' selected="selected"' ?>>IMAP</option>
             <option value="imap/notls"<?php if ($protocol == 'imap/notls') echo ' selected="selected"' ?>><?php echo _("IMAP, no TLS") ?></option>
@@ -235,7 +234,7 @@
 <?php if ($conf['server']['change_folders'] && $conf['server']['server_list'] == 'none'): ?>
 <tr>
     <td align="right" class="light"><b><?php echo _("Folder Prefix") ?></b></td>
-    <td align="left"><input type="text" tabindex="3" name="folders" value="<?php echo Horde::getFormData('folders', $folders_value) ?>" /></td>
+    <td align="left"><input type="text" tabindex="<?php echo $tabindex++ ?>" name="folders" value="<?php echo Horde::getFormData('folders', $folders_value) ?>" /></td>
 </tr>
 <?php else: ?>
 <tr>
@@ -243,10 +242,11 @@
 </tr>
 <?php endif; ?>
 
+<?php if (!empty($servers_list) || $conf['server']['change_server']): ?>
 <tr>
     <td align="right" class="light"><b><?php echo _("Username") ?></b></td>
     <td align="left" class="light" nowrap="nowrap">
-      <input type="text" tabindex="1" name="imapuser" value="<?php echo htmlspecialchars(Horde::getFormData('imapuser', getenv('REMOTE_USER'))) ?>" />
+      <input type="text" tabindex="<?php echo $tabindex++ ?>" name="imapuser" value="<?php echo htmlspecialchars(Horde::getFormData('imapuser', getenv('REMOTE_USER'))) ?>" />
     <?php
         if (!empty($conf['hooks']['vinfo'])) {
             @include_once HORDE_BASE . '/config/hooks.php';
@@ -257,20 +257,22 @@
 </tr>
 <tr>
     <td align="right" class="light"><b><?php echo _("Password") ?></b></td>
-    <td align="left"><input type="password" tabindex="2" name="pass" /></td>
+    <td align="left"><input type="password" tabindex="<?php echo $tabindex++ ?>" name="pass" /></td>
 </tr>
 
 <?php if (!$prefs->isLocked('language')): ?>
 <tr>
     <td align="right" class="light"><b><?php echo _("Language") ?></b></td>
-    <td align="left" class="light"><?php echo $langs ?></td>
+    <td align="left" class="light"><select tabindex="<?php echo $tabindex++ ?>" name="new_lang" onchange="selectLang()"><?php echo $langs ?></select>
+    </td>
 </tr>
 <?php endif; ?>
 
 <tr>
     <td>&nbsp;</td>
-    <td align="left" class="light"><input type="submit" class="button" name="loginButton" tabindex="4" value="<?php echo _("Log in") ?>" onclick="return submit_login();" /></td>
+    <td align="left" class="light"><input type="submit" class="button" name="loginButton" tabindex="<?php echo $tabindex++ ?>" value="<?php echo _("Log in") ?>" onclick="return submit_login();" /></td>
 </tr>
+<?php endif; ?>
 
 <?php if ($conf['signup']['allow'] && $auth->hasCapability('add')): ?>
 <tr>


More information about the dev mailing list