예제 #1
0
        } else {
            $input_errors[] = gettext("Authentication failed.");
        }
    }
} else {
    if (isset($config['system']['webgui']['authmode'])) {
        $pconfig['authmode'] = $config['system']['webgui']['authmode'];
    } else {
        $pconfig['authmode'] = "Local Database";
    }
}
$pgtitle = array(gettext("Diagnostics"), gettext("Authentication"));
$shortcut_section = "authentication";
include "head.inc";
if ($input_errors) {
    print_input_errors($input_errors);
}
if ($savemsg) {
    print '<div class="alert alert-success" role="alert">' . $savemsg . '</div>';
}
$form = new Form('Test');
$section = new Form_Section('Authentication Test');
foreach (auth_get_authserver_list() as $auth_server) {
    $serverlist[$auth_server['name']] = $auth_server['name'];
}
$section->addInput(new Form_Select('authmode', 'Authentication Server', $pconfig['authmode'], $serverlist))->setHelp('Select the authentication server to test against');
$section->addInput(new Form_Input('username', 'Username', 'text', $pconfig['username'], ['placeholder' => 'Username']));
$section->addInput(new Form_Input('password', 'Password', 'password', $pconfig['password'], ['placeholder' => 'Password']));
$form->add($section);
print $form;
include "foot.inc";
예제 #2
0
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
*/
require_once "guiconfig.inc";
require_once "auth.inc";
$auth_server_types = array('ldap' => "LDAP", 'radius' => "Radius", 'voucher' => "Voucher");
if (!isset($config['system']['authserver'])) {
    $config['system']['authserver'] = array();
}
if (empty($config['ca']) || !is_array($config['ca'])) {
    $config['ca'] = array();
}
$a_servers = auth_get_authserver_list();
$a_server = array();
foreach ($a_servers as $servers) {
    $a_server[] = $servers;
}
$act = null;
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
    // input record id, if valid
    if (isset($_GET['id']) && isset($a_server[$_GET['id']])) {
        $id = $_GET['id'];
    }
    if (isset($_GET['act'])) {
        $act = $_GET['act'];
    }
    $pconfig = array();
    if ($act == "new") {
}
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Authentication Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
/* Default to pfsense backend type if none is defined */
if (!$pconfig['backend']) {
    $pconfig['backend'] = "pfsense";
}
$form = new Form();
$section = new Form_Section('Settings');
$section->addInput(new Form_Input('session_timeout', 'Session timeout', 'number', $pconfig['session_timeout'], ['min' => 0]))->setHelp('Time in minutes to expire idle management sessions. The default is 4 ' . 'hours (240 minutes). Enter 0 to never expire sessions. NOTE: This is a security ' . 'risk!');
$auth_servers = array();
foreach (auth_get_authserver_list() as $idx_authserver => $auth_server) {
    $auth_servers[$idx_authserver] = $auth_server['name'];
}
$section->addInput(new Form_Select('authmode', 'Authentication Server', $pconfig['authmode'], $auth_servers));
$form->addGlobal(new Form_Button('savetest', 'Save & Test', null, 'fa-wrench'))->addClass('btn-info');
$form->add($section);
$modal = new Modal("LDAP settings", "testresults", true);
$modal->addInput(new Form_StaticText('Test results', '<span id="ldaptestop">Testing pfSense LDAP settings... One moment please...' . $g['product_name'] . '</span>'));
$form->add($modal);
print $form;
// If the user clicked "Save & Test" show the modal and populate it with the test results via AJAX
if ($save_and_test) {
    ?>
<script type="text/javascript">
//<![CDATA[
events.push(function() {