Updating pot
[squirrelmail.git] / src / login.php
index 10584e2002ae24c2d419f776a0ed14886e2854bd..f124cceffd643560d7527d6b57527291683c1745 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * login.php -- simple login screen
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This a simple login screen. Some housekeeping is done to clean
@@ -55,17 +55,19 @@ header('Pragma: no-cache');
  * squelches the display of the login form and puts up a message
  * explaining the situation.
  */
-$imap = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
-$logindisabled = sqimap_capability($imap,'LOGINDISABLED');
-sqimap_logout($imap);
-if ($logindisabled) {
-    $string = "The IMAP server is reporting that logins are disabled.<br>";
-    if (!$use_imap_tls) {
-        $string .= "The use of TLS may allow SquirrelMail to login.<br>";
+if($imap_auth_mech == 'login') {
+    $imap = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
+    $logindisabled = sqimap_capability($imap,'LOGINDISABLED');
+    sqimap_logout($imap);
+    if ($logindisabled) {
+        $string = "The IMAP server is reporting that logins are disabled.<br>";
+        if (!$use_imap_tls) {
+            $string .= "The use of TLS may allow SquirrelMail to login.<br>";
+        }
+        $string .= "Please contact your system administrator.";
+        error_box($string,$color);
+        exit;
     }
-    $string .= "Please contact your system administrator.";
-    error_box($string,$color);
-    exit;
 }
 
 do_hook('login_cookie');
@@ -75,7 +77,6 @@ do_hook('login_cookie');
 $header = "<script language=\"JavaScript\" type=\"text/javascript\">\n" .
           "<!--\n".
           "  function squirrelmail_loginpage_onload() {\n".
-          "    document.forms[0].js_autodetect_results.value = '" . SMPREF_JS_ON . "';\n".
           "    var textElements = 0;\n".
           "    for (i = 0; i < document.forms[0].elements.length; i++) {\n".
           "      if (document.forms[0].elements[i].type == \"text\" || document.forms[0].elements[i].type == \"password\") {\n".
@@ -96,7 +97,7 @@ if (@file_exists($theme[$theme_default]['PATH']))
 displayHtmlHeader( "$org_name - " . _("Login"), $header, FALSE );
 
 echo "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\" onLoad=\"squirrelmail_loginpage_onload()\">" .
-     "\n" . '<form action="redirect.php" method="post">' . "\n";
+     "\n" . '<form action="redirect.php" method="post" onSubmit="document.forms[0].js_autodetect_results.value=\'' . SMPREF_JS_ON .'\';">' . "\n";
 
 $username_form_name = 'login_username';
 $password_form_name = 'secretkey';
@@ -158,7 +159,7 @@ echo html_tag( 'table',
                                 'right', '', 'width="30%"' ) .
                                 html_tag( 'td',
                                     '<input type="password" name="' . $password_form_name . '" />' . "\n" .
-                                    '<input type="hidden" name="js_autodetect_results" value="SMPREF_JS_OFF" />' . "\n" .
+                                    '<input type="hidden" name="js_autodetect_results" value="'.SMPREF_JS_OFF.'" />' . "\n" .
                                     $rcptaddress .
                                     '<input type="hidden" name="just_logged_in" value="1" />' . "\n",
                                 'left', '', 'width="*"' )