Project

General

Profile

Download (4.31 KB) Statistics
| Branch: | Tag: | Revision:
1 3f0357fc Ermal Lu?i
<?php
2
/*
3
	diag_arp.php
4
	part of the pfSense project	(http://www.pfsense.org)
5
	Copyright (C) 2010 Ermal Lu?i
6
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	notice, this list of conditions and the following disclaimer in the
17
	documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30
31
/*
32
	pfSense_MODULE:	auth
33
*/
34
35
##|+PRIV
36
##|*IDENT=page-diagnostics-authentication
37
##|*NAME=Diagnostics: Authentication page
38
##|*DESCR=Allow access to the 'Diagnostics: Authentication' page.
39
##|*MATCH=diag_authentication.php*
40
##|-PRIV
41
42
require("guiconfig.inc");
43 6e815096 Ermal
require_once("PEAR.inc");
44
require_once("radius.inc");
45 3f0357fc Ermal Lu?i
46
if ($_POST) {
47
	$pconfig = $_POST;
48
	unset($input_errors);
49
50
	$authcfg = auth_get_authserver($_POST['authmode']);
51
	if (!$authcfg)
52 f8ec8de4 Renato Botelho
		$input_errors[] = $_POST['authmode'] . " " . gettext("is not a valid authentication server");
53 3f0357fc Ermal Lu?i
54
	if (empty($_POST['username']) || empty($_POST['password']))
55 f8ec8de4 Renato Botelho
		$input_errors[] = gettext("A username and password must be specified.");
56 3f0357fc Ermal Lu?i
57
	if (!$input_errors) {
58 fb0f22c0 Ermal Lu?i
		if (authenticate_user($_POST['username'], $_POST['password'], $authcfg)) {
59 3f178953 Erik Fonnesbeck
			$savemsg = gettext("User") . ": " . $_POST['username'] . " " . gettext("authenticated successfully.");
60 fb0f22c0 Ermal Lu?i
			$groups = getUserGroups($_POST['username'], $authcfg);
61 3f178953 Erik Fonnesbeck
			$savemsg .= "<br />" . gettext("This user is a member of these groups") . ": <br />";
62 fb0f22c0 Ermal Lu?i
			foreach ($groups as $group)
63
				$savemsg .= "{$group} ";
64
		} else {
65 f8ec8de4 Renato Botelho
			$input_errors[] = gettext("Authentication failed.");
66 fb0f22c0 Ermal Lu?i
		}
67 3f0357fc Ermal Lu?i
	}
68
}
69 f8ec8de4 Renato Botelho
$pgtitle = array(gettext("Diagnostics"),gettext("Authentication"));
70 3f0357fc Ermal Lu?i
include("head.inc");
71
72
?>
73
74
<body link="#000000" vlink="#000000" alink="#000000">
75 f8ec8de4 Renato Botelho
76 3f0357fc Ermal Lu?i
<?php include("fbegin.inc"); ?>
77
<?php if ($input_errors) print_input_errors($input_errors);?>
78
<?php if ($savemsg) print_info_box($savemsg);?>
79
80
<table width="100%" border="0" cellpadding="0" cellspacing="0">
81
	<tr>
82
		<td class="tabnavtbl"></td>
83
	</tr>
84
	<tr>
85
	<td>
86
	<div id="mainarea">
87
	<form id="iform" name="iform" action="diag_authentication.php" method="post">
88
	<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
89
	<tr>
90 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
91 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
92
			<select name='authmode' id='authmode' class="formselect" >
93
			<?php
94
				$auth_servers = auth_get_authserver_list();
95
				foreach ($auth_servers as $auth_server):
96
					$selected = "";
97
					if ($auth_server['name'] == $pconfig['authmode'])
98
						$selected = "selected";
99
			?>
100
			<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
101
			<?php   endforeach; ?>
102
			</select>
103
		</td>
104
	</tr>
105
	<tr>
106 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
107 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
108 dd5bf424 Scott Ullrich
			<input class="formfld unknown" size='20' id='username' name='username' value='<?=htmlspecialchars($pconfig['username']);?>' />
109 3f0357fc Ermal Lu?i
		</td>
110
	</tr>
111
	<tr>
112 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
113 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
114 dd5bf424 Scott Ullrich
			<input class="formfld pwd" type='password' size='20' id='password' name='password' value='<?=htmlspecialchars($pconfig['password']);?>' />
115 3f0357fc Ermal Lu?i
		</td>
116
	</tr>
117
	<tr>
118
		<td width="22%" valign="top">&nbsp;</td>
119
		<td width="78%">
120 335f296f Chris Buechler
			<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Test");?>" />
121 3f0357fc Ermal Lu?i
		</td>
122
	</tr>
123
	</table>
124
	</td></tr>
125
</table>
126
127
<?php include("fend.inc"); ?>