Code

Added retype password field
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 May 2007 13:22:50 +0000 (13:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 May 2007 13:22:50 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6232 594d385d-05f5-0310-b6e9-bd551577e9d8

setup/class_setupStep_Migrate.inc
setup/setup_migrate.tpl

index 42288d6aa9ff7a3105f9318d483e03ddfde3e8f5..57fc5efdcba52fefec994aa229ccb0e15a896a25 100644 (file)
@@ -819,13 +819,20 @@ class Step_Migrate extends setup_step
   
   function create_admin_user()
   {
-    if(isset($_POST['new_user_password']) && !empty($_POST['new_user_password'])){
-      $pwd = $_POST['new_user_password'];
-    }else{
-      print_red(_("Please specify a valid password for the new GOsa admin user."));
-      return(FALSE);
+    $pw1 = $pw2 = "";
+
+    if(isset($_POST['new_user_password'])){
+      $pw1 = $_POST['new_user_password'];
     }
-    
+    if(isset($_POST['new_user_password2'])){
+      $pw2 = $_POST['new_user_password2'];
+    }
+  
+    if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
+      print_red(_("Specified passwords are empty or not equal."));
+      return false;
+    }
     /* Establish ldap connection */
     $cv = $this->parent->captured_values;
     $ldap = new LDAP($cv['admin'],
@@ -846,7 +853,7 @@ class Step_Migrate extends setup_step
     $methods = @passwordMethod::get_available_methods_if_not_loaded();
     $p_m = $methods[$cv['encryption']];
     $p_c = new $p_m(array());
-    $hash = $p_c->generate_hash($pwd);
+    $hash = $p_c->generate_hash($pw2);
 
     $new_user=array();
     $new_user['objectClass']= array("top","person","gosaAccount","organizationalPerson","inetOrgPerson");
@@ -865,10 +872,12 @@ class Step_Migrate extends setup_step
     
     if(!$res){
       print_red($ldap->get_error());
+      return(FALSE);
     }
   
     $this->acl_create_dialog=FALSE;        
     $this->check_administrativeAccount();
+    return(TRUE);
   }
  
 
@@ -1155,13 +1164,15 @@ class Step_Migrate extends setup_step
     }
 
     if(isset($_POST['create_admin_user'])){
-      $this->create_admin_user();
-      $this->dialog = FALSE;
+      if($this->create_admin_user()){
+        $this->dialog = FALSE;
+      }
     }
 
     if($this->acl_create_dialog){
       $smarty = get_smarty();
       $smarty->assign("new_user_password",@$_POST['new_user_password']);
+      $smarty->assign("new_user_password2",@$_POST['new_user_password2']);
       $smarty->assign("users" ,$this->get_user_list());
       $smarty->assign("users_cnt" ,count($this->get_user_list()));
       $smarty->assign("groups",$this->get_group_list());
index 51139288abcc459b0ab22de77dfee1631af3ae6c..0d11494e7d9144f040d958107f0d1debe3439a82 100644 (file)
                                                <input type='input' value='{$new_user_password}' name='new_user_password'><br>
                                        </td>
                                </tr>
+                               </tr>
+                                       <td>
+                                               {t}Retype password{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='input' value='{$new_user_password2}' name='new_user_password2'><br>
+                                       </td>
+                               </tr>
                        </table>
                        <input type='submit' name='create_admin_user' value='{t}Create{/t}'>    
                        </p>