Exemplo n.º 1
0
     session::global_set('_LAST_PAGE_REQUEST', time());
 }
 // Get posted values
 $current_password = get_post('current_password');
 $new_password = get_post('new_password');
 $repeated_password = get_post('new_password_repeated');
 // Get configuration flags for further input checks.
 $check_differ = $config->get_cfg_value("core", "passwordMinDiffer") != "";
 $differ = $config->get_cfg_value("core", "passwordMinDiffer");
 $check_length = $config->get_cfg_value("core", "passwordMinLength") != "";
 $length = $config->get_cfg_value("core", "passwordMinLength");
 // Once an error has occured it is stored here.
 $message = array();
 // Perform GOsa password policy checks
 if (!tests::is_uid($uid)) {
     $message[] = msgPool::invalid(_("Login"));
 } elseif (empty($current_password)) {
     $message[] = _("You need to specify your current password in order to proceed.");
 } elseif ($new_password != $repeated_password) {
     $message[] = _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
 } elseif ($new_password == "") {
     $message[] = _("The password you've entered as 'New password' is empty.");
 } elseif ($check_differ && substr($current_password, 0, $differ) == substr($new_password, 0, $differ)) {
     $message[] = _("The password used as new and current are too similar.");
 } elseif ($check_length && strlen($new_password) < $length) {
     $message[] = _("The password used as new is to short.");
 } elseif (!passwordMethod::is_harmless($new_password)) {
     $message[] = _("The password contains possibly problematic Unicode characters!");
 }
 // Connect as the given user and load its ACLs
 if (!count($message)) {