Code

Udpated JS focus,
[gosa.git] / html / index.php
index d9615399a6766d4e1b97c563895c4e7305b5c0af..756d503782033ee7c98f871ab4e123477114ae3c 100644 (file)
@@ -70,7 +70,7 @@ function displayLogin()
       $smarty->assign("errors", $_SESSION['errors']);
     }
     if ($error_collector != ""){
-      $smarty->assign("php_errors", $error_collector."</div>");
+      $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."</div>");
     } else {
       $smarty->assign("php_errors", "");
     }
@@ -230,7 +230,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
       $cfg['connection']= $config->current['SERVER'];
       $cfg['tls']       = $tls;
   
-      $str = check_schema($cfg,preg_match("/(true|yes|on|1)/i",$config->current['RFC2307BIS']));
+      $str = check_schema($cfg,isset($config->current['RFC2307BIS']) && preg_match("/(true|yes|on|1)/i",$config->current['RFC2307BIS']));
 
       $checkarr = array();
       foreach($str as $tr){
@@ -270,7 +270,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
 
     /* Login as user, initialize user ACL's */
     $ui= ldap_login_user($username, $_POST["password"]);
-    if ($ui === NULL || $ui == 0){
+    if ($ui === NULL || !$ui ){
       $message= _("Please check the username/password combination.");
       $smarty->assign ('nextfield', 'password');
       gosa_log ("Authentication failed for user \"$username\"");
@@ -378,8 +378,16 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
-displayLogin();
 
+/* Set focus to the error button if we've an error message */
+$focus= "";
+if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){
+  $focus= '<script language="JavaScript" type="text/javascript">';
+  $focus.= 'document.forms[0].error_accept.focus();';
+  $focus.= '</script>';
+}
+$smarty->assign("focus", $focus);
+displayLogin();
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>