Exemple #1
0
    }
    if (empty($validation_errors['pass'])) {
        if ($login_method != 'ldap' && !empty($pass1) && !empty($pass2)) {
            //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
Exemple #2
0
$failed = TRUE;
$default_user = '';
// FIRST LOGIN
$cnd_1 = $first_login == 'yes' && $accepted == 'yes';
$cnd_2 = $pass != '' && $pass1 != '' && $pass == $pass1;
$cnd_3 = $email != '' && $fullname != '';
if ($cnd_1 && $cnd_2 && $cnd_3) {
    ossim_valid($pass, OSS_PASSWORD, 'illegal:' . _('Password'));
    ossim_valid($pass1, OSS_PASSWORD, 'illegal:' . _('Repeat Password'));
    if (ossim_error()) {
        die(ossim_error());
    }
    //Check password policy
    $pp_1 = strlen($pass) < $pass_length_min;
    $pp_2 = strlen($pass) > $pass_length_max;
    $pp_3 = Session::pass_check_complexity($pass) == FALSE;
    if ($pp_1 || $pp_2 || $pp_3) {
        if ($pp_1 == TRUE) {
            ossim_set_error(sprintf(_('Password is not long enough [Minimum password size is %s]'), $pass_length_min));
        } elseif ($pp_2 == TRUE) {
            ossim_set_error(sprintf(_('Password is too long [Maximum password size is %s]'), $pass_length_max));
        } elseif ($pp_3 == TRUE) {
            ossim_set_error(_("The password does not meet the password complexity requirements [Password should contain lowercase and uppercase letters, digits and special characters]"));
        }
        if (ossim_error()) {
            die(ossim_error());
        }
    }
    $config = new Config();
    $first_login = '******';
    //Update admin info