diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index af2658688d078d5034be5cc05213decad355e521..2d27f7c4f50c7a51662ddec92b8a73ea1d7c3e3b 100644 (file)
}
}
- // Check password via check hook
- if ($this->config->get_cfg_value("core","passwordHook") != ""){
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->cat($this->dn,array('uid'));
- $attrs = $ldap->fetch();
- $cmd = $this->config->get_cfg_value("core","passwordHook");
- $cmd = preg_replace("/%current_password/",'',$cmd);
- $cmd = preg_replace("/%new_password/",escapeshellarg($new_password), $cmd);
- $cmd = preg_replace("/%uid/",escapeshellarg($attrs['uid'][0]), $cmd);
- $cmd = preg_replace("/%dn/",escapeshellarg($attrs['dn']), $cmd);
- exec($cmd,$resarr);
- $message = array_merge($message, $resarr);
+ // Call external check hook to validate the password change
+ if(!count($message)){
+ $attrs = array();
+ $attrs['current_password'] = '';
+ $attrs['new_password'] = $new_password;
+ $checkRes = password::callCheckHook($this->config,$this->dn,$attrs);
+ if(count($checkRes)){
+ $message[] = sprintf(_("Check-hook reported a problem: %s. Password change canceled!"),
+ implode($checkRes));
+ }
}
// Display errors
return($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
+
+
// Change cassword
if(isset($this->force_hash_type[$this->dn])){
- if(!change_password ($this->dn, $new_password,0,$this->force_hash_type[$this->dn])){
+ if(!change_password ($this->dn, $new_password,0,$this->force_hash_type[$this->dn],'', $message)){
+ msg_dialog::displayChecks(array($message));
return($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
}else{
- if(!change_password ($this->dn, $new_password)){
+ if(!change_password ($this->dn, $new_password,0,'','',$message)){
+ msg_dialog::displayChecks(array($message));
return($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
}