Code

Fixed problem with password hash modifications and missing password change request
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Dec 2009 10:11:47 +0000 (10:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 14 Dec 2009 10:11:47 +0000 (10:11 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14896 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/users/class_userManagement.inc

index 1b14c0a5a7b0e8d26eb1fedba2f7490c979d2580..50029c1c27b504ec6ea12c1bfad1bf3642cf725a 100644 (file)
@@ -33,6 +33,7 @@ class userManagement extends management
   var $edit_uid = "";
 
   var $pwd_change_queue = array();
+  var $force_hash_type = array();
 
   // Tab definition 
   protected $tabClass = "usertabs";
@@ -256,8 +257,14 @@ class userManagement extends management
       }
 
       // Change cassword 
-      if(!change_password ($this->dn, $_POST['new_password'])){
-        return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+      if(isset($this->force_hash_type[$this->dn])){
+        if(!change_password ($this->dn, $_POST['new_password'],0,$this->force_hash_type[$this->dn])){
+          return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+        }
+      }else{
+        if(!change_password ($this->dn, $_POST['new_password'])){
+          return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+        }
       }
       if ($this->config->get_cfg_value("passwordHook") != ""){
         exec($this->config->get_cfg_value("passwordHook")." ".$username." ".$_POST['new_password'], $resarr);
@@ -287,7 +294,12 @@ class userManagement extends management
   function saveChanges()
   {
     management::saveChanges();
-    if($this->last_dn == "new"){
+
+    if(isset($this->last_tabObject->by_object['user']) && $this->last_tabObject->by_object['user']->password_change_needed()){
+      $this->force_hash_type[$this->last_tabObject->dn] = $this->last_tabObject->by_object['user']->pw_storage;
+      $this->pwd_change_queue[] = $this->last_tabObject->dn;
+      return($this->handlePasswordQueue());
+    }elseif($this->last_dn == "new"){
       $this->pwd_change_queue[] = $this->last_tabObject->dn;
       return($this->handlePasswordQueue());
     }