Project

General

Profile

Download (6.34 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	part of pfSense (https://www.pfsense.org/)
5

    
6
	Copyright (C) 2007 Scott Ullrich <sullrich@gmail.com>
7
	Copyright (C) 2007 Bill Marquette <bill.marquette@gmail.com>
8
        Copyright (C) 2013-2014 Electric Sheep Fencing, LP
9
	All rights reserved.
10

    
11
	Redistribution and use in source and binary forms, with or without
12
	modification, are permitted provided that the following conditions are met:
13

    
14
	1. Redistributions of source code must retain the above copyright notice,
15
	   this list of conditions and the following disclaimer.
16

    
17
	2. Redistributions in binary form must reproduce the above copyright
18
	   notice, this list of conditions and the following disclaimer in the
19
	   documentation and/or other materials provided with the distribution.
20

    
21
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
23
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
25
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
	POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*
33
	pfSense_MODULE:	auth
34
*/
35

    
36
##|+PRIV
37
##|*IDENT=page-system-usermanager-settings
38
##|*NAME=System: User Manager: settings page
39
##|*DESCR=Allow access to the 'System: User Manager: settings' page.
40
##|*MATCH=system_usermanager_settings.php*
41
##|-PRIV
42

    
43
require("guiconfig.inc");
44

    
45
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
46
$pconfig['authmode'] = &$config['system']['webgui']['authmode'];
47
$pconfig['backend'] = &$config['system']['webgui']['backend'];
48

    
49
// Page title for main admin
50
$pgtitle = array(gettext("System"),gettext("User manager settings"));
51

    
52
$save_and_test = false;
53
if ($_POST) {
54
	unset($input_errors);
55
	$pconfig = $_POST;
56

    
57
	if(isset($_POST['session_timeout'])) {
58
		$timeout = intval($_POST['session_timeout']);
59
		if ($timeout != "" && (!is_numeric($timeout) || $timeout <= 0))
60
			$input_errors[] = gettext("Session timeout must be an integer value.");
61
	}
62

    
63
	if (!$input_errors) {
64
		if ($_POST['authmode'] != "local") {
65
			$authsrv = auth_get_authserver($_POST['authmode']);
66
			if ($_POST['savetest'])
67
				if ($authsrv['type'] == "ldap")
68
					$save_and_test = true;
69
				else
70
					$savemsg = gettext("The test was not performed because it is supported only for ldap based backends.");
71
		}
72

    
73

    
74
		if(isset($_POST['session_timeout']) && $_POST['session_timeout'] != "")
75
			$config['system']['webgui']['session_timeout'] = intval($_POST['session_timeout']);
76
		else
77
			unset($config['system']['webgui']['session_timeout']);
78

    
79
		if($_POST['authmode'])
80
			$config['system']['webgui']['authmode'] = $_POST['authmode'];
81
		else
82
			unset($config['system']['webgui']['authmode']);
83

    
84
		write_config();
85

    
86
	}
87
}
88

    
89
include("head.inc");
90
?>
91

    
92
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
93
<?php include("fbegin.inc");?>
94
<?php if ($input_errors) print_input_errors($input_errors);?>
95
<?php if ($savemsg) print_info_box($savemsg);?>
96

    
97
<?php
98
	if($save_and_test) {
99
		echo "<script type=\"text/javascript\">\n";
100
		echo "//<![CDATA[\n";
101
		echo "myRef = window.open('system_usermanager_settings_test.php?authserver={$pconfig['authmode']}','mywin', ";
102
		echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
103
		echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected.  Action aborted.") ."');\n";
104
		echo "//]]>\n";
105
		echo "</script>\n";
106
	}
107
?>
108

    
109
	<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="user manager settings">
110
		<tr>
111
			<td class="tabnavtbl">
112
<?php
113
				$tab_array = array();
114
				$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
115
				$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
116
				$tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
117
				$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
118
				display_top_tabs($tab_array);
119

    
120
				/* Default to pfsense backend type if none is defined */
121
				if(!$pconfig['backend'])
122
					$pconfig['backend'] = "pfsense";
123
?>
124
			</td>
125
		</tr>
126
		<tr>
127
			<td>
128
				<div id="mainarea">
129
					<form id="iform" name="iform" action="system_usermanager_settings.php" method="post">
130
						<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="main area">
131
							<tr>
132
								<td width="22%" valign="top" class="vncell"><?=gettext("Session Timeout"); ?></td>
133
								<td width="78%" class="vtable">
134
									<input name="session_timeout" id="session_timeout" type="text" size="8" value="<?=htmlspecialchars($pconfig['session_timeout']);?>" />
135
									<br />
136
									<?=gettext("Time in minutes to expire idle management sessions. The default is 4 hours (240 minutes).");?><br />
137
									<?=gettext("Enter 0 to never expire sessions. NOTE: This is a security risk!");?><br />
138
								</td>
139
							</tr>
140
							<tr>
141
								<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
142
								<td width="78%" class="vtable">
143
									<select name='authmode' id='authmode' class="formselect" >
144
<?php
145
									$auth_servers = auth_get_authserver_list();
146
									foreach ($auth_servers as $auth_server):
147
										$selected = "";
148
										if ($auth_server['name'] == $pconfig['authmode'])
149
											$selected = "selected=\"selected\"";
150
										if (!isset($pconfig['authmode']) && $auth_server['name'] == "Local Database")
151
											$selected = "selected=\"selected\"";
152
?>
153
										<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
154
<?php
155
									endforeach;
156
?>
157
									</select>
158
								</td>
159
							</tr>
160
							<tr>
161
								<td width="22%" valign="top">&nbsp;</td>
162
								<td width="78%">
163
									<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
164
									<input id="savetest" name="savetest" type="submit" class="formbtn" value="<?=gettext("Save and Test");?>" />
165
								</td>
166
							</tr>
167
						</table>
168
					</form>
169
				</div>
170
			</td>
171
		</tr>
172
	</table>
173
<?php include("fend.inc");?>
174
</body>
175
</html>
(232-232/256)