Example #1
0
     } 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'] = $current_password;
     $attrs['new_password'] = $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));
     }
 }
 // Display error messages
 if (count($message) != 0) {
     msg_dialog::displayChecks($message);
 } else {
     // Try to change the password
     if (!change_password($ui->dn, $_POST['new_password'], FALSE, $method, get_post('current_password'), $msg)) {
         msg_dialog::displayChecks(array($msg));
     } else {
         gosa_log("User/password has been changed");
         $smarty->assign("changed", true);
     }