Project

General

Profile

Download (6.51 KB) Statistics
| Branch: | Tag: | Revision:
1 f98bfed2 Ermal Lu?i
<?php
2
/* $Id$ */
3
/*
4
    part of pfSense (http://www.pfsense.org/)
5
6
	Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
7
	All rights reserved.
8
9
    Copyright (C) 2007 Bill Marquette <bill.marquette@gmail.com>
10
    All rights reserved.
11
12
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14
15
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17
18
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33
/*
34
	pfSense_MODULE:	auth
35
*/
36
37
##|+PRIV
38
##|*IDENT=page-system-usermanager-settings
39
##|*NAME=System: User manager: settings page
40
##|*DESCR=Allow access to the 'System: User manager: settings' page.
41
##|*MATCH=system_usermanager_settings.php*
42
##|-PRIV
43
44
require("guiconfig.inc");
45
46
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
47 6306b5dd Ermal Lu?i
$pconfig['authmode'] = &$config['system']['webgui']['authmode'];
48 f98bfed2 Ermal Lu?i
$pconfig['backend'] = &$config['system']['webgui']['backend'];
49
50
// Page title for main admin
51 e2f0ac59 Carlos Eduardo Ramos
$pgtitle = array(gettext("System"),gettext("User manager settings"));
52 f98bfed2 Ermal Lu?i
53 b641a575 Ermal
$save_and_test = false;
54 f98bfed2 Ermal Lu?i
if ($_POST) {
55
	unset($input_errors);
56 6306b5dd Ermal Lu?i
	$pconfig = $_POST;
57 f98bfed2 Ermal Lu?i
58 02647583 Ermal
	if(isset($_POST['session_timeout'])) {
59 f98bfed2 Ermal Lu?i
		$timeout = intval($_POST['session_timeout']);
60 8cd27a98 Ermal Lu?i
		if ($timeout != "" && (!is_numeric($timeout) || $timeout <= 0))
61 f98bfed2 Ermal Lu?i
			$input_errors[] = gettext("Session timeout must be an integer value.");
62
	}
63
64
	if (!$input_errors) {
65 b641a575 Ermal
		if ($_POST['savetest'] && $_POST['authmode'] == "ldap")
66
			$save_and_test = true;
67
		else
68
			$savemsg = gettext("The test was not performed becuase it is supported only for ldap based backends.");
69
70 f98bfed2 Ermal Lu?i
71 34a2fb1b Erik Fonnesbeck
		if(isset($_POST['session_timeout']) && $_POST['session_timeout'] != "")
72 6306b5dd Ermal Lu?i
			$config['system']['webgui']['session_timeout'] = intval($_POST['session_timeout']);
73 f98bfed2 Ermal Lu?i
		else
74
			unset($config['system']['webgui']['session_timeout']);
75
76 6306b5dd Ermal Lu?i
		if($_POST['authmode'])
77
			$config['system']['webgui']['authmode'] = $_POST['authmode'];
78 f98bfed2 Ermal Lu?i
		else
79 6306b5dd Ermal Lu?i
			unset($config['system']['webgui']['authmode']);
80 f98bfed2 Ermal Lu?i
81
		write_config();
82
83
	}
84
}
85
86
include("head.inc");
87
?>
88
89
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
90
<?php include("fbegin.inc");?>
91
<?php if ($input_errors) print_input_errors($input_errors);?>
92
<?php if ($savemsg) print_info_box($savemsg);?>
93
94
<?php
95
	if($save_and_test) {
96
		echo "<script language='javascript'>\n";
97 6306b5dd Ermal Lu?i
		echo "myRef = window.open('system_usermanager_settings_test.php?authserver={$pconfig['authmode']}','mywin', ";
98 f98bfed2 Ermal Lu?i
		echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
99 e2f0ac59 Carlos Eduardo Ramos
		echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected.  Action aborted.") ."');\n";
100 f98bfed2 Ermal Lu?i
		echo "</script>\n";
101
	}
102
?>
103
104
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
105
    <tr>
106
      <td class="tabnavtbl">
107
<?php
108
    $tab_array = array();
109
    $tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
110
    $tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
111
    $tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
112 6306b5dd Ermal Lu?i
    $tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
113 f98bfed2 Ermal Lu?i
    display_top_tabs($tab_array);
114
115
/* Default to pfsense backend type if none is defined */
116
if(!$pconfig['backend'])
117
	$pconfig['backend'] = "pfsense";
118
119
?>
120
      </td>
121
    <tr>
122
       <td>
123
            <div id="mainarea">
124
            <form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
125
              <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
126 6306b5dd Ermal Lu?i
		<tr>
127 e2f0ac59 Carlos Eduardo Ramos
                        <td width="22%" valign="top" class="vncell"><?=gettext("Session Timeout"); ?></td>
128 f98bfed2 Ermal Lu?i
                        <td width="78%" class="vtable">
129 6306b5dd Ermal Lu?i
				<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
130
                          	<br />
131 0e94685b Renato Botelho
				<?=gettext("Time in minutes to expire idle management sessions. The default is 4 hours (240 minutes).");?><br/>
132
				<?=gettext("Enter 0 to never expire sessions. NOTE: This is a security risk!");?><br />
133 6306b5dd Ermal Lu?i
			</td>
134
		</tr>
135
		<tr>
136 e2f0ac59 Carlos Eduardo Ramos
                        <td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
137 f98bfed2 Ermal Lu?i
                        <td width="78%" class="vtable">
138 6306b5dd Ermal Lu?i
				<select name='authmode' id='authmode' class="formselect" >
139
                                        <?php
140
						$auth_servers = auth_get_authserver_list();
141
                                        	foreach ($auth_servers as $auth_server):
142
                                                	$selected = "";
143
                                                        if ($auth_server['name'] == $pconfig['authmode'])
144
                                                        	$selected = "selected";
145 2959a190 Chris Buechler
							if (!isset($pconfig['authmode']) && $auth_server['name'] == "Local Database")
146
								$selected = "selected";
147
148 6306b5dd Ermal Lu?i
                                        ?>
149
                                        <option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
150
                                        <?php   endforeach; ?>
151
                                </select>
152
			</td>
153
		</tr>
154
		<tr>
155
			<td width="22%" valign="top">&nbsp;</td>
156
			<td width="78%">
157
				<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
158
				<input id="savetest" name="savetest" type="submit" class="formbtn" value="<?=gettext("Save and Test");?>" />
159
			</td>
160
               	</tr>
161 f98bfed2 Ermal Lu?i
              </table>
162
            </form>
163
            </div>
164
      </td>
165
    </tr>
166
  </table>
167
<?php include("fend.inc");?>
168
</body>
169
</html>