Code

Allow to select password methods in templates.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 08:47:47 +0000 (08:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 Nov 2008 08:47:47 +0000 (08:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12863 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/generic/class_user.inc

index 2cbe1f0038e5613e2599c5a5f1c009b4b1860eb8..d07458802a52c9acafc922769d1f98b1d745e12c 100644 (file)
@@ -1049,7 +1049,14 @@ class user extends plugin
 
     /* Set password to some junk stuff in case of templates */
     if ($this->is_template){
-      $this->attrs['userPassword']= '{crypt}N0T$3T4N0W';
+      $temp= passwordMethod::get_available_methods();
+      foreach($temp as $id => $data){
+        if(isset($data['name']) && $data['name'] == $this->pw_storage){
+          $tmp = new  $temp[$this->pw_storage]($this->config,$this->dn);
+          $this->attrs['userPassword'] = $tmp->create_template_hash($this->attrs);
+          break;
+        }
+      }
     }
 
     @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,