Project

General

Profile

Download (4.36 KB) Statistics
| Branch: | Tag: | Revision:
1 3f0357fc Ermal Lu?i
<?php
2
/*
3 939cc57a Warren Baker
	diag_authentication.php
4 3f0357fc Ermal Lu?i
	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 d71fc5d3 jim-p
$shortcut_section = "authentication";
71 3f0357fc Ermal Lu?i
include("head.inc");
72
73
?>
74
75
<body link="#000000" vlink="#000000" alink="#000000">
76 f8ec8de4 Renato Botelho
77 3f0357fc Ermal Lu?i
<?php include("fbegin.inc"); ?>
78
<?php if ($input_errors) print_input_errors($input_errors);?>
79
<?php if ($savemsg) print_info_box($savemsg);?>
80
81
<table width="100%" border="0" cellpadding="0" cellspacing="0">
82
	<tr>
83
		<td class="tabnavtbl"></td>
84
	</tr>
85
	<tr>
86
	<td>
87
	<div id="mainarea">
88
	<form id="iform" name="iform" action="diag_authentication.php" method="post">
89
	<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
90
	<tr>
91 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Authentication Server"); ?></td>
92 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
93
			<select name='authmode' id='authmode' class="formselect" >
94
			<?php
95
				$auth_servers = auth_get_authserver_list();
96
				foreach ($auth_servers as $auth_server):
97
					$selected = "";
98
					if ($auth_server['name'] == $pconfig['authmode'])
99
						$selected = "selected";
100
			?>
101
			<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option>
102
			<?php   endforeach; ?>
103
			</select>
104
		</td>
105
	</tr>
106
	<tr>
107 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Username"); ?></td>
108 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
109 605ae553 Renato Botelho
			<input class="formfld unknown" size='20' id='username' name='username' value="<?=htmlspecialchars($pconfig['username']);?>" />
110 3f0357fc Ermal Lu?i
		</td>
111
	</tr>
112
	<tr>
113 f8ec8de4 Renato Botelho
		<td width="22%" valign="top" class="vncell"><?=gettext("Password"); ?></td>
114 3f0357fc Ermal Lu?i
		<td width="78%" class="vtable">
115 605ae553 Renato Botelho
			<input class="formfld pwd" type='password' size='20' id='password' name='password' value="<?=htmlspecialchars($pconfig['password']);?>" />
116 3f0357fc Ermal Lu?i
		</td>
117
	</tr>
118
	<tr>
119
		<td width="22%" valign="top">&nbsp;</td>
120
		<td width="78%">
121 335f296f Chris Buechler
			<input id="save" name="save" type="submit" class="formbtn" value="<?=gettext("Test");?>" />
122 3f0357fc Ermal Lu?i
		</td>
123
	</tr>
124
	</table>
125
	</td></tr>
126
</table>
127
128
<?php include("fend.inc"); ?>