if ($data['auth_type'] == ZBX_AUTH_INTERNAL) {
    if (!$this->data['userid'] || isset($this->data['change_password'])) {
        $userFormList->addRow(_('Password'), new CPassBox('password1', $this->data['password1'], ZBX_TEXTBOX_SMALL_SIZE));
        $userFormList->addRow(_('Password (once again)'), new CPassBox('password2', $this->data['password2'], ZBX_TEXTBOX_SMALL_SIZE));
        if (isset($this->data['change_password'])) {
            $userForm->addVar('change_password', $this->data['change_password']);
        }
    } else {
        $passwdButton = new CSubmit('change_password', _('Change password'), null, 'formlist');
        if ($this->data['alias'] == ZBX_GUEST_USER) {
            $passwdButton->setAttribute('disabled', 'disabled');
        }
        $userFormList->addRow(_('Password'), $passwdButton);
    }
} else {
    $userFormList->addRow(_('Password'), new CSpan(_s('Unavailable for users with %1$s.', authentication2str($data['auth_type']))));
}
// append languages to form list
$languageComboBox = new CComboBox('lang', $this->data['lang']);
$allLocalesAvailable = true;
foreach (getLocales() as $localeId => $locale) {
    if ($locale['display']) {
        // checking if this locale exists in the system. The only way of doing it is to try and set one
        // trying to set only the LC_MONETARY locale to avoid changing LC_NUMERIC
        $localeExists = setlocale(LC_MONETARY, zbx_locale_variants($localeId)) || $localeId == 'en_GB';
        $languageComboBox->addItem($localeId, $locale['name'], $localeId == $this->data['lang'] ? true : null, $localeExists);
        $allLocalesAvailable &= $localeExists;
    }
}
// restoring original locale
setlocale(LC_MONETARY, zbx_locale_variants(CWebUser::$data['lang']));
        $messageFailed = _('Cannot change authentication method to HTTP');
        DBstart();
        $result = update_config($config);
        if ($result) {
            // reset all sessions
            if ($isAuthenticationTypeChanged) {
                $result &= DBexecute('UPDATE sessions SET status=' . ZBX_SESSION_PASSIVE . ' WHERE sessionid<>' . zbx_dbstr(CWebUser::$data['sessionid']));
            }
            $isAuthenticationTypeChanged = false;
            add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ZABBIX_CONFIG, $messageSuccess);
        }
        $result = DBend($result);
        show_messages($result, $messageSuccess, $messageFailed);
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => getRequest('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => getRequest('user', CWebUser::$data['alias']), 'user_password' => getRequest('user_password', ''), 'user_list' => null, 'change_bind_password' => getRequest('change_bind_password'));
// get tab title
$data['title'] = authentication2str($config['authentication_type']);
// get user list
if (getUserGuiAccess(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid FROM users u ORDER BY u.alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
Beispiel #3
0
        $_REQUEST['user_medias'][$_REQUEST['disable_media']]['active'] = 1;
    }
} elseif (hasRequest('add') || hasRequest('update')) {
    $config = select_config();
    $isValid = true;
    $usrgrps = getRequest('user_groups', array());
    // authentication type
    if ($usrgrps) {
        $authType = getGroupAuthenticationType($usrgrps, GROUP_GUI_ACCESS_INTERNAL);
    } else {
        $authType = hasRequest('userid') ? getUserAuthenticationType(getRequest('userid'), GROUP_GUI_ACCESS_INTERNAL) : $config['authentication_type'];
    }
    // password validation
    if ($authType != ZBX_AUTH_INTERNAL) {
        if (hasRequest('password1')) {
            show_error_message(_s('Password is unavailable for users with %1$s.', authentication2str($authType)));
            $isValid = false;
        } else {
            if (hasRequest('userid')) {
                $_REQUEST['password1'] = null;
                $_REQUEST['password2'] = null;
            } else {
                $_REQUEST['password1'] = 'zabbix';
                $_REQUEST['password2'] = 'zabbix';
            }
        }
    } else {
        $_REQUEST['password1'] = getRequest('password1');
        $_REQUEST['password2'] = getRequest('password2');
    }
    if ($_REQUEST['password1'] != $_REQUEST['password2']) {