Example #1
0
//Extended validation
if (empty($validation_errors['login'])) {
    //Checking permissions to create or modify users
    if ($mode == 'insert') {
        if (!$am_i_admin && !$am_i_proadmin) {
            $validation_errors['login'] = _("You don't have permission to create users");
        } else {
            $s_login = escape_sql($login, $conn, FALSE);
            $u_list = Session::get_list($conn, "WHERE login='" . $s_login . "'");
            if (count($u_list) > 0) {
                $validation_errors['login'] = _('User login already exists') . '. <br/>' . _('Entered value') . ": '<strong>" . Util::htmlentities($login) . "</strong>'";
            }
        }
    } else {
        $condition_1 = $am_i_admin && $login != AV_DEFAULT_ADMIN || $is_my_profile;
        $condition_2 = $am_i_proadmin && Session::userAllowed($login) == 2;
        if (!($condition_1 || $condition_2)) {
            $validation_errors['login'] = _("You don't have permission to modify this user");
        }
    }
}
//Checking password field requirements
if (empty($validation_errors['pass'])) {
    //Checking current password
    $admin_login_method = $myself->get_login_method();
    if ($admin_login_method != 'ldap') {
        if ($myself->get_pass() != md5($c_pass) && $myself->get_pass() != hash('sha256', $c_pass)) {
            $validation_errors['pass'] = _('Authentication failure') . '. ' . _('Admin password is not correct');
        }
    } else {
        if (!Session::login_ldap($myself->get_login(), $c_pass)) {
Example #2
0
*/
require_once 'av_init.php';
require_once 'languages.inc';
Session::useractive('../session/login.php');
$conf = $GLOBALS['CONF'];
/* Connect to db */
$db = new ossim_db();
$conn = $db->connect();
// Expire session
$action = REQUEST('action');
if ($action == 'expire_session') {
    if (!Token::verify('tk_f_users', GET('token'))) {
        Token::show_error();
        exit;
    }
    if (Session::userAllowed($user_id) > 1) {
        Session_activity::expire_my_others_sessions($conn, $user_id);
    }
}
/* Version */
$pro = Session::is_pro();
//Timezone
$tzlist = timezone_identifiers_list(4095);
sort($tzlist);
//Login method list
$lm_list = array('ldap' => _('LDAP'), 'pass' => _('PASSWORD'));
//Entities and Templates
$noentities = 0;
$notemplates = 0;
if ($pro) {
    $entity_list = Session::get_entities_to_assign($conn);