Revision 5f601060
Added by Phil Davis about 10 years ago
usr/local/www/diag_authentication.php | ||
---|---|---|
10 | 10 |
modification, are permitted provided that the following conditions are met: |
11 | 11 |
|
12 | 12 |
1. Redistributions of source code must retain the above copyright notice, |
13 |
this list of conditions and the following disclaimer. |
|
13 |
this list of conditions and the following disclaimer.
|
|
14 | 14 |
|
15 | 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. |
|
16 |
notice, this list of conditions and the following disclaimer in the
|
|
17 |
documentation and/or other materials provided with the distribution.
|
|
18 | 18 |
|
19 | 19 |
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
20 | 20 |
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
... | ... | |
48 | 48 |
unset($input_errors); |
49 | 49 |
|
50 | 50 |
$authcfg = auth_get_authserver($_POST['authmode']); |
51 |
if (!$authcfg) |
|
51 |
if (!$authcfg) {
|
|
52 | 52 |
$input_errors[] = $_POST['authmode'] . " " . gettext("is not a valid authentication server"); |
53 |
} |
|
53 | 54 |
|
54 |
if (empty($_POST['username']) || empty($_POST['passwordfld'])) |
|
55 |
if (empty($_POST['username']) || empty($_POST['passwordfld'])) {
|
|
55 | 56 |
$input_errors[] = gettext("A username and password must be specified."); |
57 |
} |
|
56 | 58 |
|
57 | 59 |
if (!$input_errors) { |
58 | 60 |
if (authenticate_user($_POST['username'], $_POST['passwordfld'], $authcfg)) { |
59 | 61 |
$savemsg = gettext("User") . ": " . $_POST['username'] . " " . gettext("authenticated successfully."); |
60 | 62 |
$groups = getUserGroups($_POST['username'], $authcfg); |
61 | 63 |
$savemsg .= "<br />" . gettext("This user is a member of these groups") . ": <br />"; |
62 |
foreach ($groups as $group) |
|
64 |
foreach ($groups as $group) {
|
|
63 | 65 |
$savemsg .= "{$group} "; |
66 |
} |
|
64 | 67 |
} else { |
65 | 68 |
$input_errors[] = gettext("Authentication failed."); |
66 | 69 |
} |
... | ... | |
95 | 98 |
$auth_servers = auth_get_authserver_list(); |
96 | 99 |
foreach ($auth_servers as $auth_server): |
97 | 100 |
$selected = ""; |
98 |
if ($auth_server['name'] == $pconfig['authmode']) |
|
101 |
if ($auth_server['name'] == $pconfig['authmode']) {
|
|
99 | 102 |
$selected = "selected=\"selected\""; |
103 |
} |
|
100 | 104 |
?> |
101 | 105 |
<option value="<?=$auth_server['name'];?>" <?=$selected;?>><?=$auth_server['name'];?></option> |
102 |
<?php endforeach; ?>
|
|
106 |
<?php endforeach; ?> |
|
103 | 107 |
</select> |
104 | 108 |
</td> |
105 | 109 |
</tr> |
Also available in: Unified diff
Code style usr-local-www diag