summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6c496e6)
raw | patch | inline | side by side (parent: 6c496e6)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 9 Sep 2010 12:57:11 +0000 (12:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 9 Sep 2010 12:57:11 +0000 (12:57 +0000) |
-Updated check Hook call
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19586 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19586 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/html/password.php | patch | blob | history | |
gosa-core/plugins/personal/password/class_password.inc | patch | blob | history |
index 6c04fb525e204debfa9709179cffa16bc94fac16..fc5fe83afac6f99c43f98002f0e2cc39f980a693 100644 (file)
// Once an error has occured it is stored here.
$message = array();
- // Call the check hook
- $attrs = array();
- $attrs['current_password'] = escapeshellarg($current_password);
- $attrs['new_password'] = escapeshellarg($new_password);
-
// Perform GOsa password policy checks
if(!tests::is_uid($uid)) {
$message[]= msgPool::invalid(_("Login"));
}
// Connect as the given user and load its ACLs
- $ui= ldap_login_user($uid, $current_password);
- if ($ui === NULL) {
- $message[]= _("Please check the username/password combination!");
- } else {
- $tmp= new acl($config, NULL, $ui->dn);
- $ui->ocMapping= $tmp->ocMapping;
- $ui->loadACL();
- $acls = $ui->get_permissions($ui->dn, "users/password");
- if (!preg_match("/w/i", $acls)) {
- $message[]= _("You have no permissions to change your password!");
+ if(!count($message)){
+ $ui= ldap_login_user($uid, $current_password);
+ if ($ui === NULL) {
+ $message[]= _("Please check the username/password combination!");
+ } else {
+ $tmp= new acl($config, NULL, $ui->dn);
+ $ui->ocMapping= $tmp->ocMapping;
+ $ui->loadACL();
+ $acls = $ui->get_permissions($ui->dn, "users/password");
+ if (!preg_match("/w/i", $acls)) {
+ $message[]= _("You have no permissions to change your password!");
+ }
+ }
+ }
+
+ // Call external check hook to validate the password change
+ if(!count($message)){
+ $attrs = array();
+ $attrs['current_password'] = escapeshellarg($current_password);
+ $attrs['new_password'] = escapeshellarg($new_password);
+ $checkRes = password::callCheckHook($config,$ui->dn,$attrs);
+ if(count($checkRes)){
+ $message[] = sprintf(_("Check-hook reported a problem: %s. Password change canceled!"),implode($checkRes));
}
}
diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc
index a436e941f263ba89df9ddfc37e9e9a613ce7e292..84422ce039527cc816b155970d2bbd3f5f0d8eda 100644 (file)
// Call external check hook to validate the password change
if(!count($message)){
- $checkRes = $this->callCheckHook($attrs);
+ $checkRes = $this->callCheckHook($this->config,$this->dn,$attrs);
if(count($checkRes)){
$message[] = sprintf(_("Check-hook reported a problem: %s. Password change canceled!"),implode($checkRes));
}
{
}
- function callCheckHook($attrs = array())
+ static function callCheckHook($config,$dn,$attrs = array())
{
- $command = $this->config->configRegistry->getPropertyValue(get_class($this),"check");
+ $command = $config->configRegistry->getPropertyValue("password","check");
if (!empty($command)){
// Build up ldif to send to the check hook
- $ldif= "dn: $this->dn\n";
+ $ldif= "dn: $dn\n";
foreach ($attrs as $name => $value){
$ldif.= "{$name}: {$value}\n";
}