Project

General

Profile

Download (6.28 KB) Statistics
| Branch: | Tag: | Revision:
1
<?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
if($_POST['savetest'])
45
	$save_and_test = true;
46

    
47
require("guiconfig.inc");
48

    
49
$pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout'];
50
$pconfig['authmode'] = &$config['system']['webgui']['authmode'];
51
$pconfig['backend'] = &$config['system']['webgui']['backend'];
52

    
53
// Page title for main admin
54
$pgtitle = array(gettext("System"),gettext("User manager settings"));
55

    
56
if ($_POST) {
57
	unset($input_errors);
58
	$pconfig = $_POST;
59

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

    
66
	if (!$input_errors) {
67

    
68
		if(isset($_POST['session_timeout']) && $_POST['session_timeout'] != "")
69
			$config['system']['webgui']['session_timeout'] = intval($_POST['session_timeout']);
70
		else
71
			unset($config['system']['webgui']['session_timeout']);
72

    
73
		if($_POST['authmode'])
74
			$config['system']['webgui']['authmode'] = $_POST['authmode'];
75
		else
76
			unset($config['system']['webgui']['authmode']);
77

    
78
		write_config();
79

    
80
	}
81
}
82

    
83
include("head.inc");
84
?>
85

    
86
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
87
<?php include("fbegin.inc");?>
88
<?php if ($input_errors) print_input_errors($input_errors);?>
89
<?php if ($savemsg) print_info_box($savemsg);?>
90

    
91
<?php
92
	if($save_and_test) {
93
		echo "<script language='javascript'>\n";
94
		echo "myRef = window.open('system_usermanager_settings_test.php?authserver={$pconfig['authmode']}','mywin', ";
95
		echo "'left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n";
96
		echo "if (myRef==null || typeof(myRef)=='undefined') alert('" . gettext("Popup blocker detected.  Action aborted.") ."');\n";
97
		echo "</script>\n";
98
	}
99
?>
100

    
101
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
102
    <tr>
103
      <td class="tabnavtbl">
104
<?php
105
    $tab_array = array();
106
    $tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
107
    $tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
108
    $tab_array[] = array(gettext("Settings"), true, "system_usermanager_settings.php");
109
    $tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
110
    display_top_tabs($tab_array);
111

    
112
/* Default to pfsense backend type if none is defined */
113
if(!$pconfig['backend'])
114
	$pconfig['backend'] = "pfsense";
115

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