//Getting password length $conf = $GLOBALS['CONF']; $pass_length_min = $conf->get_conf('pass_length_min') ? $conf->get_conf('pass_length_min') : 7; $pass_length_max = $conf->get_conf('pass_length_max') ? $conf->get_conf('pass_length_max') : 255; $pass_length_max = $pass_length_max < $pass_length_min || $pass_length_max < 1 ? 255 : $pass_length_max; $pass_expire_min = $conf->get_conf('pass_expire_min') ? $conf->get_conf('pass_expire_min') : 0; if (0 != strcmp($pass1, $pass2)) { $validation_errors['pass'] = _('Authentication failure') . '. ' . _('Passwords mismatch'); } elseif (strlen($pass1) < $pass_length_min) { $validation_errors['pass'] = _('Password is not long enough') . ' [' . _('Minimum password size is') . ' ' . $pass_length_min . ']'; } elseif (strlen($pass1) > $pass_length_max) { $validation_errors['pass'] = _('Password is long enough') . ' [' . _('Maximum password size is') . ' ' . $pass_length_max . ']'; } elseif (!Session::pass_check_complexity($pass1)) { $validation_errors['pass'] = _('Password is not strong enough. Check the password policy configuration for more details'); } elseif ($mode == 'update') { $recent_pass = Log_action::get_last_pass($conn, $login); if ($pass_expire_min > 0 && dateDiff_min($last_pass_change, date('Y-m-d H:i:s')) < $pass_expire_min && !Session::am_i_admin()) { $validation_errors['pass'] = _('Password lifetime is too short to allow change. Wait a few minutes...'); } elseif (count($recent_pass) > 0 && (in_array(md5($pass1), $recent_pass) || in_array(hash('sha256', $pass1), $recent_pass))) { $validation_errors['pass'] = _('This password is recently used. Try another'); } } } } } //Checking entities field requirements if (empty($validation_errors['entities[]'])) { //Check allowed entities if ($pro && !$is_my_profile) { foreach ($entities as $ent_id) { if (!Acl::entityAllowed($ent_id)) {
*/ require_once 'av_init.php'; /* connect to db */ $db = new ossim_db(); $conn = $db->connect(); if ($_SESSION['_user']) { $user = $_SESSION['_user']; unset($_SESSION); // destroy session to force password change session_destroy(); session_start(); $_SESSION['_backup_user'] = $user; } else { $user = $_SESSION['_backup_user']; } $recent_pass = Log_action::get_last_pass($conn, $user); $conf = $GLOBALS['CONF']; if (!isset($_SESSION['_user']) && !isset($_SESSION['_backup_user'])) { $ossim_link = $conf->get_conf('ossim_link'); $login_location = $ossim_link . '/session/login.php'; header("Location: {$login_location}"); exit; } $version = $conf->get_conf('ossim_server_version'); $opensource = !preg_match("/.*pro.*/i", $version) && !preg_match("/.*demo.*/i", $version) ? TRUE : FALSE; $pass1 = base64_decode(POST('pass1')); $pass2 = base64_decode(POST('pass2')); $current_pass = base64_decode(POST('current_pass')); $flag = POST('flag'); $changeadmin = POST('changeadmin'); $expired = POST('expired');