1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
system_usermanager.php
|
5
|
part of m0n0wall (http://m0n0.ch/wall)
|
6
|
|
7
|
Copyright (C) 2008 Shrew Soft Inc.
|
8
|
All rights reserved.
|
9
|
|
10
|
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
|
14
|
All rights reserved.
|
15
|
|
16
|
Redistribution and use in source and binary forms, with or without
|
17
|
modification, are permitted provided that the following conditions are met:
|
18
|
|
19
|
1. Redistributions of source code must retain the above copyright notice,
|
20
|
this list of conditions and the following disclaimer.
|
21
|
|
22
|
2. Redistributions in binary form must reproduce the above copyright
|
23
|
notice, this list of conditions and the following disclaimer in the
|
24
|
documentation and/or other materials provided with the distribution.
|
25
|
|
26
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
27
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
28
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
29
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
30
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
31
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
32
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
33
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
34
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
35
|
POSSIBILITY OF SUCH DAMAGE.
|
36
|
*/
|
37
|
|
38
|
##|+PRIV
|
39
|
##|*IDENT=page-system-usermanager
|
40
|
##|*NAME=System: User Manager page
|
41
|
##|*DESCR=Allow access to the 'System: User Manager' page.
|
42
|
##|*MATCH=system_usermanager.php*
|
43
|
##|-PRIV
|
44
|
|
45
|
|
46
|
require("guiconfig.inc");
|
47
|
|
48
|
if (isAllowedPage("system_usermanager")) {
|
49
|
|
50
|
// start admin user code
|
51
|
$pgtitle = array("System","User Manager");
|
52
|
|
53
|
$id = $_GET['id'];
|
54
|
if (isset($_POST['id']))
|
55
|
$id = $_POST['id'];
|
56
|
|
57
|
if (!is_array($config['system']['user']))
|
58
|
$config['system']['user'] = array();
|
59
|
|
60
|
admin_users_sort();
|
61
|
$a_user = &$config['system']['user'];
|
62
|
|
63
|
if ($_GET['act'] == "deluser") {
|
64
|
|
65
|
if (!$a_user[$_GET['id']]) {
|
66
|
pfSenseHeader("system_usermanager.php");
|
67
|
exit;
|
68
|
}
|
69
|
|
70
|
local_user_del($a_user[$_GET['id']]);
|
71
|
$userdeleted = $a_user[$_GET['id']]['name'];
|
72
|
unset($a_user[$_GET['id']]);
|
73
|
write_config();
|
74
|
$savemsg = gettext("User")." {$userdeleted} ".
|
75
|
gettext("successfully deleted")."<br/>";
|
76
|
}
|
77
|
|
78
|
if ($_GET['act'] == "delpriv") {
|
79
|
|
80
|
if (!$a_user[$_GET['id']]) {
|
81
|
pfSenseHeader("system_usermanager.php");
|
82
|
exit;
|
83
|
}
|
84
|
|
85
|
$privdeleted = $priv_list[$a_user[$id]['priv'][$_GET['privid']]]['name'];
|
86
|
unset($a_user[$id]['priv'][$_GET['privid']]);
|
87
|
write_config();
|
88
|
unset($t_privs[$_GET['privid']]);
|
89
|
$_GET['act'] = "edit";
|
90
|
$savemsg = gettext("Privilege")." {$privdeleted} ".
|
91
|
gettext("successfully deleted")."<br/>";
|
92
|
}
|
93
|
|
94
|
if ($_GET['act'] == "edit") {
|
95
|
if (isset($id) && $a_user[$id]) {
|
96
|
$pconfig['usernamefld'] = $a_user[$id]['name'];
|
97
|
$pconfig['fullname'] = $a_user[$id]['fullname'];
|
98
|
$pconfig['groups'] = local_user_get_groups($a_user[$id]);
|
99
|
$pconfig['utype'] = $a_user[$id]['scope'];
|
100
|
$pconfig['uid'] = $a_user[$id]['uid'];
|
101
|
$pconfig['authorizedkeys'] = base64_decode($a_user[$id]['authorizedkeys']);
|
102
|
$pconfig['priv'] = $a_user[$id]['priv'];
|
103
|
}
|
104
|
}
|
105
|
|
106
|
if ($_GET['act'] == "new") {
|
107
|
/*
|
108
|
* set this value cause the text field is read only
|
109
|
* and the user should not be able to mess with this
|
110
|
* setting.
|
111
|
*/
|
112
|
$pconfig['utype'] = "user";
|
113
|
}
|
114
|
|
115
|
if ($_POST) {
|
116
|
unset($input_errors);
|
117
|
$pconfig = $_POST;
|
118
|
|
119
|
/* input validation */
|
120
|
if (isset($id) && ($a_user[$id])) {
|
121
|
$reqdfields = explode(" ", "usernamefld");
|
122
|
$reqdfieldsn = explode(",", "Username");
|
123
|
} else {
|
124
|
$reqdfields = explode(" ", "usernamefld passwordfld1");
|
125
|
$reqdfieldsn = explode(",", "Username,Password");
|
126
|
}
|
127
|
|
128
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
129
|
|
130
|
if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['usernamefld']))
|
131
|
$input_errors[] = gettext("The username contains invalid characters.");
|
132
|
|
133
|
if (($_POST['passwordfld1']) && ($_POST['passwordfld1'] != $_POST['passwordfld2']))
|
134
|
$input_errors[] = gettext("The passwords do not match.");
|
135
|
|
136
|
/* make sure this user name is unique */
|
137
|
if (!$input_errors && !(isset($id) && $a_user[$id])) {
|
138
|
foreach ($a_user as $userent) {
|
139
|
if ($userent['name'] == $_POST['usernamefld']) {
|
140
|
$input_errors[] = gettext("Another entry with the same username already exists.");
|
141
|
break;
|
142
|
}
|
143
|
}
|
144
|
}
|
145
|
|
146
|
if(is_array($_POST['groups']))
|
147
|
foreach($_POST['groups'] as $groupname)
|
148
|
if ($pconfig['utype'] <> "system" && !isset($groupindex[$groupname]))
|
149
|
$input_errors[] = gettext("group {$groupname} does not exist, please define the group before assigning users.");
|
150
|
|
151
|
if (isset($config['system']['ssh']['sshdkeyonly']) && empty($_POST['authorizedkeys']))
|
152
|
$input_errors[] = gettext("You must provide an authorized key otherwise you won't be able to login into this system.");
|
153
|
|
154
|
/* if this is an AJAX caller then handle via JSON */
|
155
|
if (isAjax() && is_array($input_errors)) {
|
156
|
input_errors2Ajax($input_errors);
|
157
|
exit;
|
158
|
}
|
159
|
|
160
|
if (!$input_errors) {
|
161
|
$userent = array();
|
162
|
if (isset($id) && $a_user[$id])
|
163
|
$userent = $a_user[$id];
|
164
|
|
165
|
/* the user name was modified */
|
166
|
if ($_POST['usernamefld'] <> $_POST['oldusername'])
|
167
|
$_SERVER['REMOTE_USER'] = $_POST['usernamefld'];
|
168
|
|
169
|
/* the user password was mofified */
|
170
|
if ($_POST['passwordfld1'])
|
171
|
local_user_set_password($userent, $_POST['passwordfld1']);
|
172
|
|
173
|
$userent['name'] = $_POST['usernamefld'];
|
174
|
$userent['fullname'] = $_POST['fullname'];
|
175
|
|
176
|
isset($_POST['utype']) ? $userent['scope'] = $_POST['utype'] : $userent['scope'] = "system";
|
177
|
|
178
|
if(isset($config['system']['ssh']['sshdkeyonly']))
|
179
|
$userent['authorizedkeys'] = base64_encode($_POST['authorizedkeys']);
|
180
|
|
181
|
if (isset($id) && $a_user[$id])
|
182
|
$a_user[$id] = $userent;
|
183
|
else {
|
184
|
$userent['uid'] = $config['system']['nextuid']++;
|
185
|
$a_user[] = $userent;
|
186
|
}
|
187
|
|
188
|
local_user_set($userent);
|
189
|
local_user_set_groups($userent,$_POST['groups']);
|
190
|
write_config();
|
191
|
|
192
|
pfSenseHeader("system_usermanager.php");
|
193
|
}
|
194
|
}
|
195
|
|
196
|
include("head.inc");
|
197
|
?>
|
198
|
|
199
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
200
|
<?php include("fbegin.inc"); ?>
|
201
|
<script language="JavaScript">
|
202
|
<!--
|
203
|
|
204
|
function setall_selected(id) {
|
205
|
selbox = document.getElementById(id);
|
206
|
count = selbox.options.length;
|
207
|
for (index = 0; index<count; index++)
|
208
|
selbox.options[index].selected = true;
|
209
|
}
|
210
|
|
211
|
function clear_selected(id) {
|
212
|
selbox = document.getElementById(id);
|
213
|
count = selbox.options.length;
|
214
|
for (index = 0; index<count; index++)
|
215
|
selbox.options[index].selected = false;
|
216
|
}
|
217
|
|
218
|
function remove_selected(id) {
|
219
|
selbox = document.getElementById(id);
|
220
|
index = selbox.options.length - 1;
|
221
|
for (; index >= 0; index--)
|
222
|
if (selbox.options[index].selected)
|
223
|
selbox.remove(index);
|
224
|
}
|
225
|
|
226
|
function copy_selected(srcid, dstid) {
|
227
|
src_selbox = document.getElementById(srcid);
|
228
|
dst_selbox = document.getElementById(dstid);
|
229
|
count = src_selbox.options.length;
|
230
|
for (index = 0; index < count; index++) {
|
231
|
if (src_selbox.options[index].selected) {
|
232
|
option = document.createElement('option');
|
233
|
option.text = src_selbox.options[index].text;
|
234
|
option.value = src_selbox.options[index].value;
|
235
|
dst_selbox.add(option, null);
|
236
|
}
|
237
|
}
|
238
|
}
|
239
|
|
240
|
function move_selected(srcid, dstid) {
|
241
|
copy_selected(srcid, dstid);
|
242
|
remove_selected(srcid);
|
243
|
}
|
244
|
|
245
|
function presubmit() {
|
246
|
clear_selected('notgroups');
|
247
|
setall_selected('groups');
|
248
|
}
|
249
|
|
250
|
//-->
|
251
|
</script>
|
252
|
<?php
|
253
|
if ($input_errors)
|
254
|
print_input_errors($input_errors);
|
255
|
if ($savemsg)
|
256
|
print_info_box($savemsg);
|
257
|
?>
|
258
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
259
|
<tr>
|
260
|
<td class="tabnavtbl">
|
261
|
<?php
|
262
|
$tab_array = array();
|
263
|
$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
|
264
|
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
|
265
|
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
|
266
|
display_top_tabs($tab_array);
|
267
|
?>
|
268
|
</td>
|
269
|
</tr>
|
270
|
<tr>
|
271
|
<td class="tabcont">
|
272
|
|
273
|
<?php if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors): ?>
|
274
|
|
275
|
<form action="system_usermanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
|
276
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
277
|
<?php
|
278
|
$ro = "";
|
279
|
if ($pconfig['utype'] == "system")
|
280
|
$ro = "readonly = \"readonly\"";
|
281
|
?>
|
282
|
<tr>
|
283
|
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
|
284
|
<td width="78%" class="vtable">
|
285
|
<strong><?=strtoupper($pconfig['utype']);?></strong>
|
286
|
<input name="utype" type="hidden" value="<?=$pconfig['utype']?>"/>
|
287
|
</td>
|
288
|
</tr>
|
289
|
<tr>
|
290
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Username");?></td>
|
291
|
<td width="78%" class="vtable">
|
292
|
<input name="usernamefld" type="text" class="formfld user" id="usernamefld" size="20" value="<?=htmlspecialchars($pconfig['usernamefld']);?>" <?=$ro;?>/>
|
293
|
<input name="oldusername" type="hidden" id="oldusername" value="<?=htmlspecialchars($pconfig['usernamefld']);?>" />
|
294
|
</td>
|
295
|
</tr>
|
296
|
<tr>
|
297
|
<td width="22%" valign="top" class="vncellreq" rowspan="2"><?=gettext("Password");?></td>
|
298
|
<td width="78%" class="vtable">
|
299
|
<input name="passwordfld1" type="password" class="formfld pwd" id="passwordfld1" size="20" value="" />
|
300
|
</td>
|
301
|
</tr>
|
302
|
<tr>
|
303
|
<td width="78%" class="vtable">
|
304
|
<input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" value="" /> <?= gettext("(confirmation)"); ?>
|
305
|
</td>
|
306
|
</tr>
|
307
|
<tr>
|
308
|
<td width="22%" valign="top" class="vncell"><?=gettext("Full name");?></td>
|
309
|
<td width="78%" class="vtable">
|
310
|
<input name="fullname" type="text" class="formfld unknown" id="fullname" size="20" value="<?=htmlspecialchars($pconfig['fullname']);?>" <?=$ro;?>/>
|
311
|
<br/>
|
312
|
<?=gettext("User's full name, for your own information only");?>
|
313
|
</td>
|
314
|
</tr>
|
315
|
|
316
|
<?php if (isset($config['system']['ssh']['sshdkeyonly'])): ?>
|
317
|
|
318
|
<tr>
|
319
|
<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
|
320
|
<td width="78%" class="vtable">
|
321
|
<textarea name="authorizedkeys" cols="65" rows="7" id="authorizedkeys" class="formfld_cert" wrap="off"><?=htmlspecialchars($pconfig['authorizedkeys']);?></textarea>
|
322
|
<br/>
|
323
|
<?=gettext("Paste an authorized keys file here.");?>
|
324
|
</td>
|
325
|
</tr>
|
326
|
|
327
|
<?php endif; ?>
|
328
|
|
329
|
<tr>
|
330
|
<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
|
331
|
<td width="78%" class="vtable" align="center">
|
332
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
333
|
<tr>
|
334
|
<td align="center" width="50%">
|
335
|
<strong>Not Member Of</strong><br/>
|
336
|
<br/>
|
337
|
<select size="10" style="width: 75%" name="notgroups[]" class="formselect" id="notgroups" onChange="clear_selected('groups')" multiple>
|
338
|
<?php
|
339
|
foreach ($config['system']['group'] as $group):
|
340
|
if ($group['gid'] == 1998) /* all users group */
|
341
|
continue;
|
342
|
if (in_array($group['name'],$pconfig['groups']))
|
343
|
continue;
|
344
|
?>
|
345
|
<option value="<?=$group['name'];?>" <?=$selected;?>>
|
346
|
<?=htmlspecialchars($group['name']);?>
|
347
|
</option>
|
348
|
<?php endforeach; ?>
|
349
|
</select>
|
350
|
<br/>
|
351
|
</td>
|
352
|
<td>
|
353
|
<br/>
|
354
|
<a href="javascript:move_selected('notgroups','groups')">
|
355
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="Add Groups" alt="Add Groups" width="17" height="17" border="0" />
|
356
|
</a>
|
357
|
<br/><br/>
|
358
|
<a href="javascript:move_selected('groups','notgroups')">
|
359
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="Remove Groups" alt="Remove Groups" width="17" height="17" border="0" />
|
360
|
</a>
|
361
|
</td>
|
362
|
<td align="center" width="50%">
|
363
|
<strong>Member Of</strong><br/>
|
364
|
<br/>
|
365
|
<select size="10" style="width: 75%" name="groups[]" class="formselect" id="groups" onChange="clear_selected('nogroups')" multiple>
|
366
|
<?php
|
367
|
foreach ($config['system']['group'] as $group):
|
368
|
if ($group['gid'] == 1998) /* all users group */
|
369
|
continue;
|
370
|
if (!in_array($group['name'],$pconfig['groups']))
|
371
|
continue;
|
372
|
?>
|
373
|
<option value="<?=$group['name'];?>">
|
374
|
<?=htmlspecialchars($group['name']);?>
|
375
|
</option>
|
376
|
<?php endforeach; ?>
|
377
|
</select>
|
378
|
<br/>
|
379
|
</td>
|
380
|
</tr>
|
381
|
</table>
|
382
|
<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
|
383
|
</td>
|
384
|
</tr>
|
385
|
|
386
|
<?php if ($pconfig['uid']): ?>
|
387
|
|
388
|
<tr>
|
389
|
<td width="22%" valign="top" class="vncell"><?=gettext("Effective Privileges");?></td>
|
390
|
<td width="78%" class="vtable">
|
391
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
392
|
<tr>
|
393
|
<td width="20%" class="listhdrr"><?=gettext("Inherited From");?></td>
|
394
|
<td width="30%" class="listhdrr"><?=gettext("Name");?></td>
|
395
|
<td width="40%" class="listhdrr"><?=gettext("Description");?></td>
|
396
|
<td class="list"></td>
|
397
|
</tr>
|
398
|
<?php
|
399
|
|
400
|
$privdesc = get_user_privdesc($a_user[$_GET['id']]);
|
401
|
if(is_array($privdesc)):
|
402
|
$i = 0;
|
403
|
foreach ($privdesc as $priv):
|
404
|
$group = false;
|
405
|
if ($priv['group'])
|
406
|
$group = $priv['group'];
|
407
|
?>
|
408
|
<tr>
|
409
|
<td class="listlr"><?=$group;?></td>
|
410
|
<td class="listr">
|
411
|
<?=htmlspecialchars($priv['name']);?>
|
412
|
</td>
|
413
|
<td class="listbg">
|
414
|
<font color="#FFFFFF">
|
415
|
<?=htmlspecialchars($priv['descr']);?>
|
416
|
</font>
|
417
|
</td>
|
418
|
<td valign="middle" nowrap class="list">
|
419
|
<?php if (!$group): ?>
|
420
|
<a href="system_usermanager.php?act=delpriv&id=<?=$id?>&privid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this privilege?");?>')">
|
421
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="" />
|
422
|
</a>
|
423
|
<?php endif; ?>
|
424
|
</td>
|
425
|
</tr>
|
426
|
<?php
|
427
|
/* can only delete user priv indexes */
|
428
|
if (!$group)
|
429
|
$i++;
|
430
|
endforeach;
|
431
|
endif;
|
432
|
?>
|
433
|
<tr>
|
434
|
<td class="list" colspan="3"></td>
|
435
|
<td class="list">
|
436
|
<a href="system_usermanager_addprivs.php?userid=<?=$id?>">
|
437
|
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="" />
|
438
|
</a>
|
439
|
</td>
|
440
|
</tr>
|
441
|
</table>
|
442
|
</td>
|
443
|
</tr>
|
444
|
|
445
|
<?php endif; ?>
|
446
|
|
447
|
<tr>
|
448
|
<td width="22%" valign="top"> </td>
|
449
|
<td width="78%">
|
450
|
<input id="submit" name="save" type="submit" class="formbtn" value="Save" />
|
451
|
<?php if (isset($id) && $a_user[$id]): ?>
|
452
|
<input name="id" type="hidden" value="<?=$id;?>" />
|
453
|
<?php endif;?>
|
454
|
</td>
|
455
|
</tr>
|
456
|
</table>
|
457
|
</form>
|
458
|
|
459
|
<?php else: ?>
|
460
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
461
|
<tr>
|
462
|
<td width="25%" class="listhdrr">Username</td>
|
463
|
<td width="25%" class="listhdrr">Full name</td>
|
464
|
<td width="30%" class="listhdrr">Groups</td>
|
465
|
<td width="10%" class="list"></td>
|
466
|
</tr>
|
467
|
<?php
|
468
|
$i = 0;
|
469
|
foreach($a_user as $userent):
|
470
|
?>
|
471
|
<tr ondblclick="document.location='system_usermanager.php?act=edit&id=<?=$i;?>'">
|
472
|
<td class="listlr">
|
473
|
<table border="0" cellpadding="0" cellspacing="0">
|
474
|
<tr>
|
475
|
<td align="left" valign="center">
|
476
|
<?php
|
477
|
if($userent['scope'] != "user")
|
478
|
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
|
479
|
else
|
480
|
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
|
481
|
?>
|
482
|
<img src="<?=$usrimg;?>" alt="User" title="User" border="0" height="16" width="16" />
|
483
|
</td>
|
484
|
<td align="left" valign="middle">
|
485
|
<?=htmlspecialchars($userent['name']);?>
|
486
|
</td>
|
487
|
</tr>
|
488
|
</table>
|
489
|
</td>
|
490
|
<td class="listr"><?=htmlspecialchars($userent['fullname']);?> </td>
|
491
|
<td class="listbg">
|
492
|
<font color="white">
|
493
|
<?=implode(",",local_user_get_groups($userent));?>
|
494
|
</font>
|
495
|
|
496
|
</td>
|
497
|
<td valign="middle" nowrap class="list">
|
498
|
<a href="system_usermanager.php?act=edit&id=<?=$i;?>">
|
499
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="edit user" alt="edit user" width="17" height="17" border="0" />
|
500
|
</a>
|
501
|
<?php if($userent['scope'] != "system"): ?>
|
502
|
|
503
|
<a href="system_usermanager.php?act=deluser&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this User?");?>')">
|
504
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="delete user" alt="delete user" width="17" height="17" border="0" />
|
505
|
</a>
|
506
|
<?php endif; ?>
|
507
|
</td>
|
508
|
</tr>
|
509
|
<?php
|
510
|
$i++;
|
511
|
endforeach;
|
512
|
?>
|
513
|
<tr>
|
514
|
<td class="list" colspan="3"></td>
|
515
|
<td class="list">
|
516
|
<a href="system_usermanager.php?act=new">
|
517
|
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_plus.gif" title="add user" alt="add user" width="17" height="17" border="0" />
|
518
|
</a>
|
519
|
</td>
|
520
|
</tr>
|
521
|
<tr>
|
522
|
<td colspan="3">
|
523
|
<p>
|
524
|
<?=gettext("Additional webConfigurator users can be added here. User permissions are determined by the admin group they are a member of.");?>
|
525
|
</p>
|
526
|
<p>
|
527
|
<?=gettext("An user icon that appears grey indicates that it is a system user and thus it's only possible to modified a subset of the regular user data. Additionally such an user can't be deleted.");?>
|
528
|
</p>
|
529
|
</td>
|
530
|
</tr>
|
531
|
</table>
|
532
|
|
533
|
<?php endif; ?>
|
534
|
|
535
|
</td>
|
536
|
</tr>
|
537
|
</table>
|
538
|
<?php include("fend.inc");?>
|
539
|
</body>
|
540
|
|
541
|
<?php
|
542
|
|
543
|
// end admin user code
|
544
|
|
545
|
} else {
|
546
|
|
547
|
// start normal user code
|
548
|
|
549
|
$pgtitle = array("System","User Password");
|
550
|
|
551
|
if (isset($_POST['save'])) {
|
552
|
unset($input_errors);
|
553
|
|
554
|
/* input validation */
|
555
|
$reqdfields = explode(" ", "passwordfld1");
|
556
|
$reqdfieldsn = explode(",", "Password");
|
557
|
|
558
|
do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
|
559
|
|
560
|
if ($_POST['passwordfld1'] != $_POST['passwordfld2'])
|
561
|
$input_errors[] = "The passwords do not match.";
|
562
|
|
563
|
if (!$input_errors) {
|
564
|
// all values are okay --> saving changes
|
565
|
$config['system']['user'][$userindex[$HTTP_SERVER_VARS['AUTH_USER']]]['password'] = crypt(trim($_POST['passwordfld1']));
|
566
|
|
567
|
write_config();
|
568
|
$savemsg = "Password successfully changed<br />";
|
569
|
}
|
570
|
}
|
571
|
|
572
|
/* deterimine if user is not local to system */
|
573
|
$islocal = false;
|
574
|
foreach($config['system']['user'] as $user)
|
575
|
if($user['name'] == $_SESSION['Username'])
|
576
|
$islocal = true;
|
577
|
?>
|
578
|
|
579
|
<body link="#000000" vlink="#000000" alink="#000000" onload="<?= $jsevents["body"]["onload"] ?>">
|
580
|
<?php
|
581
|
include("head.inc");
|
582
|
include("fbegin.inc");
|
583
|
if ($input_errors)
|
584
|
print_input_errors($input_errors);
|
585
|
if ($savemsg)
|
586
|
print_info_box($savemsg);
|
587
|
|
588
|
if($islocal == false) {
|
589
|
echo "Sorry, you cannot change the password for a LDAP user.";
|
590
|
include("fend.inc");
|
591
|
exit;
|
592
|
}
|
593
|
?>
|
594
|
<form action="system_usermanager.php" method="post" name="iform" id="iform">
|
595
|
<table width="100%" border="0" cellpadding="6" cellspacing="0">
|
596
|
<tr>
|
597
|
<td colspan="2" valign="top" class="listtopic"><?=$HTTP_SERVER_VARS['AUTH_USER']?>'s Password</td>
|
598
|
</tr>
|
599
|
<tr>
|
600
|
<td width="22%" valign="top" class="vncell" rowspan="2">Password</td>
|
601
|
<td width="78%" class="vtable">
|
602
|
<input name="passwordfld1" type="password" class="formfld pwd" id="passwordfld1" size="20" />
|
603
|
</td>
|
604
|
</tr>
|
605
|
<tr>
|
606
|
<td width="78%" class="vtable">
|
607
|
<input name="passwordfld2" type="password" class="formfld pwd" id="passwordfld2" size="20" />
|
608
|
<?=gettext("(confirmation)");?>
|
609
|
<br/>
|
610
|
<span class="vexpl">
|
611
|
<?=gettext("Select a new password");?>
|
612
|
</span>
|
613
|
</td>
|
614
|
</tr>
|
615
|
<tr>
|
616
|
<td width="22%" valign="top"> </td>
|
617
|
<td width="78%">
|
618
|
<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
619
|
</td>
|
620
|
</tr>
|
621
|
</table>
|
622
|
</form>
|
623
|
<?php include("fend.inc");?>
|
624
|
</body>
|
625
|
|
626
|
<?php
|
627
|
|
628
|
} // end of normal user code
|
629
|
|
630
|
?>
|