1
|
<?php
|
2
|
/*
|
3
|
* authgui.inc
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2003-2006 Manuel Kasper <mk@neon1.net>
|
7
|
* Copyright (c) 2005-2006 Bill Marquette <bill.marquette@gmail.com>
|
8
|
* Copyright (c) 2006 Paul Taylor <paultaylor@winn-dixie.com>
|
9
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
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
|
20
|
* the documentation and/or other materials provided with the
|
21
|
* distribution.
|
22
|
*
|
23
|
* 3. All advertising materials mentioning features or use of this software
|
24
|
* must display the following acknowledgment:
|
25
|
* "This product includes software developed by the pfSense Project
|
26
|
* for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
27
|
*
|
28
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
29
|
* endorse or promote products derived from this software without
|
30
|
* prior written permission. For written permission, please contact
|
31
|
* coreteam@pfsense.org.
|
32
|
*
|
33
|
* 5. Products derived from this software may not be called "pfSense"
|
34
|
* nor may "pfSense" appear in their names without prior written
|
35
|
* permission of the Electric Sheep Fencing, LLC.
|
36
|
*
|
37
|
* 6. Redistributions of any form whatsoever must retain the following
|
38
|
* acknowledgment:
|
39
|
*
|
40
|
* "This product includes software developed by the pfSense Project
|
41
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
42
|
*
|
43
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
44
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
45
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
46
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
47
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
48
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
49
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
50
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
51
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
52
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
53
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
54
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
55
|
*/
|
56
|
|
57
|
include_once("auth.inc");
|
58
|
include_once("priv.inc");
|
59
|
if (!function_exists('platform_booting')) {
|
60
|
require_once('globals.inc');
|
61
|
}
|
62
|
|
63
|
/* Authenticate user - exit if failed */
|
64
|
if (!session_auth()) {
|
65
|
display_login_form();
|
66
|
exit;
|
67
|
}
|
68
|
|
69
|
/*
|
70
|
* Once here, the user has authenticated with the web server.
|
71
|
* We give them access only to the appropriate pages based on
|
72
|
* the user or group privileges.
|
73
|
*/
|
74
|
$allowedpages = getAllowedPages($_SESSION['Username'], $_SESSION['user_radius_attributes']);
|
75
|
|
76
|
/*
|
77
|
* Get user-based preference settings so they can be easily referenced.
|
78
|
*/
|
79
|
$user_settings = get_user_settings($_SESSION['Username']);
|
80
|
|
81
|
/*
|
82
|
* redirect to first allowed page if requesting a wrong url
|
83
|
*/
|
84
|
|
85
|
/* Fix this up otherwise the privilege check will fail. See Redmine #5909. */
|
86
|
if ($_SERVER['REQUEST_URI'] == "/") {
|
87
|
$_SERVER['REQUEST_URI'] = "/index.php";
|
88
|
}
|
89
|
|
90
|
if (!isAllowedPage($_SERVER['REQUEST_URI'])) {
|
91
|
if (count($allowedpages) > 0) {
|
92
|
$page = str_replace('*', '', $allowedpages[0]);
|
93
|
$_SESSION['Post_Login'] = true;
|
94
|
require_once("functions.inc");
|
95
|
pfSenseHeader("/{$page}");
|
96
|
|
97
|
$username = empty($_SESSION["Username"]) ? "(system)" : $_SESSION['Username'];
|
98
|
if (!empty($_SERVER['REMOTE_ADDR'])) {
|
99
|
$username .= '@' . $_SERVER['REMOTE_ADDR'];
|
100
|
}
|
101
|
log_error("{$username} attempted to access {$_SERVER['SCRIPT_NAME']} but does not have access to that page. Redirecting to {$page}.");
|
102
|
|
103
|
exit;
|
104
|
} else {
|
105
|
display_error_form("201", gettext("No page assigned to this user! Click here to logout."));
|
106
|
exit;
|
107
|
}
|
108
|
} else {
|
109
|
$_SESSION['Post_Login'] = true;
|
110
|
}
|
111
|
|
112
|
/*
|
113
|
* redirect browsers post-login to avoid pages
|
114
|
* taking action in response to a POST request
|
115
|
*/
|
116
|
if (!$_SESSION['Post_Login']) {
|
117
|
$_SESSION['Post_Login'] = true;
|
118
|
require_once("functions.inc");
|
119
|
pfSenseHeader($_SERVER['REQUEST_URI']);
|
120
|
exit;
|
121
|
}
|
122
|
|
123
|
/*
|
124
|
* Close session data to allow other scripts from same host to come in.
|
125
|
* A session can be reactivated from calling session_start again
|
126
|
*/
|
127
|
session_commit();
|
128
|
|
129
|
/*
|
130
|
* determine if the user is allowed access to the requested page
|
131
|
*/
|
132
|
function display_error_form($http_code, $desc) {
|
133
|
global $config, $user_settings, $g;
|
134
|
|
135
|
if (isAjax()) {
|
136
|
printf(gettext('Error: %1$s Description: %2$s'), $http_code, $desc);
|
137
|
return;
|
138
|
}
|
139
|
|
140
|
$logincssfile = "#770101";
|
141
|
|
142
|
?>
|
143
|
<!DOCTYPE html>
|
144
|
<html lang="en">
|
145
|
<head>
|
146
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
147
|
<link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css" type="text/css">
|
148
|
<link rel="stylesheet" href="/css/login.css" type="text/css">
|
149
|
<title><?=gettext("Error"); ?></title>
|
150
|
</head>
|
151
|
|
152
|
<body id="error" >
|
153
|
<div id="total">
|
154
|
<header>
|
155
|
<div id="headerrow">
|
156
|
<div class="row">
|
157
|
<div class="col-sm-4">
|
158
|
<div id="logodiv" style="text-align:center" class="nowarning">
|
159
|
<svg role="img" aria-labelledby="pfsense-logo" x="0px" y="0px" viewBox="0 0 282.8 84.2" width="240" height="100%">
|
160
|
<title id="pfsense-logo-svg">pfSense Logo</title>
|
161
|
<style type="text/css">
|
162
|
.logo-st0{fill:#2B40B5;}
|
163
|
.logo-st1{fill:#1475CF;}
|
164
|
.logo-st2{fill:#1C1275;}
|
165
|
</style>
|
166
|
<path class="logo-st0" d="M27.8,57.7c2.9,0,5.4-0.9,7.5-2.6c2.1-1.7,3.6-4,4.4-6.8c0.8-2.8,0.6-5.1-0.5-6.8c-1.1-1.7-3.2-2.6-6.1-2.6 c-2.9,0-5.4,0.9-7.5,2.6c-2.1,1.7-3.5,4-4.3,6.8c-0.8,2.8-0.7,5.1,0.5,6.8C22.8,56.9,24.8,57.7,27.8,57.7"/>
|
167
|
<path class="logo-st0" d="M115.1,46.6c-1.5-0.8-3-1.4-4.7-1.8c-1.7-0.4-3.2-0.7-4.7-1.1c-1.5-0.3-2.7-0.7-3.6-1.1c-0.9-0.4-1.4-1.1-1.4-2 c0-1.1,0.5-1.9,1.4-2.4c0.9-0.5,1.9-0.7,2.8-0.7c2.8,0,5,1,6.7,3.1l7-7c-1.7-1.8-3.9-3.1-6.4-3.8c-2.5-0.7-5-1.1-7.4-1.1 c-1.9,0-3.9,0.2-5.7,0.7c-1.9,0.5-3.6,1.2-5,2.3c-1.5,1-2.6,2.3-3.5,3.9c-0.9,1.6-1.3,3.5-1.3,5.7c0,2.3,0.5,4.2,1.4,5.6 c0.9,1.4,2.1,2.5,3.6,3.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,0.1,1,0.4,1.5c0.3,0.5,0.6,0.8,1.1,1.1c0.5,0.3,1,0.4,1.5,0.4c0.5,0,1-0.1,1.5-0.4 c0.5-0.3,0.8-0.6,1.1-1.1c0.3-0.5,0.4-1,0.4-1.5c0-0.5-0.1-1-0.4-1.5c-0.3-0.5-0.6-0.8-1.1-1.1C279.6,65.8,279.1,65.7,278.6,65.7z M278.6,65.1c0.6,0,1.2,0.2,1.8,0.5c0.6,0.3,1,0.7,1.3,1.3c0.3,0.6,0.5,1.2,0.5,1.8c0,0.6-0.2,1.2-0.5,1.8c-0.3,0.6-0.8,1-1.3,1.3 c-0.6,0.3-1.2,0.5-1.8,0.5c-0.6,0-1.2-0.2-1.8-0.5c-0.6-0.3-1-0.8-1.3-1.3c-0.3-0.6-0.5-1.2-0.5-1.8c0-0.6,0.2-1.2,0.5-1.8 c0.3-0.6,0.8-1,1.3-1.3C277.4,65.2,278,65.1,278.6,65.1z"/>
|
175
|
</svg>
|
176
|
</div>
|
177
|
</div>
|
178
|
<div class="col-sm-8 nowarning msgbox text-center">
|
179
|
<span id="hostspan">
|
180
|
</span>
|
181
|
</div>
|
182
|
</div>
|
183
|
</div>
|
184
|
</header>
|
185
|
|
186
|
<div style="background: <?=$logincssfile?>;" class="pagebody">
|
187
|
<div class="col-sm-2"></div>
|
188
|
|
189
|
<div class="col-sm-8 offset-md-4 logoCol">
|
190
|
<div class="loginCont center-block error-panel">
|
191
|
<a href="index.php?logout"><?=$desc;?></a>
|
192
|
</div>
|
193
|
</div>
|
194
|
|
195
|
<div class="col-sm-2"></div>
|
196
|
</div>
|
197
|
|
198
|
<footer id="3">
|
199
|
<div id="footertext">
|
200
|
<p class="text-muted">
|
201
|
<a target="_blank" href="https://www.pfsense.org/?gui=bootstrap">pfSense</a> is ©
|
202
|
2004 - 2017 by <a href="https://pfsense.org/license" class="tblnk">Rubicon Communications, LLC (Netgate)</a>. All Rights Reserved.
|
203
|
[<a href="/license.php" class="tblnk">view license</a>]
|
204
|
</p>
|
205
|
</div>
|
206
|
</footer>
|
207
|
</div>
|
208
|
</body>
|
209
|
</html>
|
210
|
|
211
|
|
212
|
<?php
|
213
|
|
214
|
} // end function
|
215
|
|
216
|
|
217
|
function display_login_form() {
|
218
|
require_once("globals.inc");
|
219
|
global $config, $g;
|
220
|
|
221
|
unset($input_errors);
|
222
|
|
223
|
if (isAjax()) {
|
224
|
if (isset($_POST['login'])) {
|
225
|
if ($_SESSION['Logged_In'] <> "True") {
|
226
|
isset($_SESSION['Login_Error']) ? $login_error = $_SESSION['Login_Error'] : $login_error = gettext("unknown reason");
|
227
|
printf("showajaxmessage('" . gettext("Invalid login (%s).") . "')", $login_error);
|
228
|
}
|
229
|
if (file_exists("{$g['tmp_path']}/webconfigurator.lock")) {
|
230
|
// TODO: add the IP from the user who did lock the device
|
231
|
$whom = file_get_contents("{$g['tmp_path']}/webconfigurator.lock");
|
232
|
printf("showajaxmessage('" . gettext("This device is currently being maintained by: %s.") . "');", $whom);
|
233
|
}
|
234
|
}
|
235
|
exit;
|
236
|
}
|
237
|
|
238
|
/* Check against locally configured IP addresses, which will catch when someone
|
239
|
port forwards WebGUI access from WAN to an internal IP on the router. */
|
240
|
global $FilterIflist, $nifty_background;
|
241
|
$local_ip = false;
|
242
|
if (strpos($_SERVER['HTTP_HOST'], ":") === FALSE) {
|
243
|
$http_host_port = explode(":", $_SERVER['HTTP_HOST']);
|
244
|
$http_host = $http_host_port[0];
|
245
|
} else {
|
246
|
$http_host = $_SERVER['HTTP_HOST'];
|
247
|
}
|
248
|
if (empty($FilterIflist)) {
|
249
|
require_once('filter.inc');
|
250
|
require_once('shaper.inc');
|
251
|
filter_generate_optcfg_array();
|
252
|
}
|
253
|
foreach ($FilterIflist as $iflist) {
|
254
|
if ($iflist['ip'] == $http_host) {
|
255
|
$local_ip = true;
|
256
|
} else if ($iflist['ipv6'] == $http_host) {
|
257
|
$local_ip = true;
|
258
|
} else if (is_array($iflist['vips'])) {
|
259
|
foreach ($iflist['vips'] as $vip) {
|
260
|
if ($vip['ip'] == $http_host) {
|
261
|
$local_ip = true;
|
262
|
break;
|
263
|
}
|
264
|
}
|
265
|
unset($vip);
|
266
|
}
|
267
|
if ($local_ip == true) {
|
268
|
break;
|
269
|
}
|
270
|
}
|
271
|
unset($FilterIflist);
|
272
|
unset($iflist);
|
273
|
|
274
|
if ($local_ip == false) {
|
275
|
if (is_array($config['openvpn']['openvpn-server'])) {
|
276
|
foreach ($config['openvpn']['openvpn-server'] as $ovpns) {
|
277
|
if (is_ipaddrv4($http_host) && !empty($ovpns['tunnel_network']) && ip_in_subnet($http_host, $ovpns['tunnel_network'])) {
|
278
|
$local_ip = true;
|
279
|
} else if (is_ipaddrv6($http_host) && !empty($ovpns['tunnel_networkv6']) && ip_in_subnet($http_host, $ovpns['tunnel_networkv6'])) {
|
280
|
$local_ip = true;
|
281
|
}
|
282
|
if ($local_ip == true) {
|
283
|
break;
|
284
|
}
|
285
|
}
|
286
|
}
|
287
|
}
|
288
|
|
289
|
// For the login form, get the settings of no particular user.
|
290
|
// That ensures we will use the system default theme for the login form.
|
291
|
$user_settings = get_user_settings("");
|
292
|
$cssfile = "/css/pfSense.css";
|
293
|
|
294
|
if (isset($user_settings['webgui']['webguicss'])) {
|
295
|
if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
|
296
|
$cssfile = "/css/" . $user_settings['webgui']['webguicss'];
|
297
|
}
|
298
|
}
|
299
|
|
300
|
$logincssfile = "#1e3f75";
|
301
|
|
302
|
if (isset($user_settings['webgui']['logincss']) && strlen($user_settings['webgui']['logincss']) == 6) {
|
303
|
$logincssfile = "#" . $user_settings['webgui']['logincss'];
|
304
|
}
|
305
|
|
306
|
if (isset($config['system']['webgui']['loginshowhost'])) {
|
307
|
$loginbannerstr = sprintf(gettext('%1$s.%2$s'), htmlspecialchars($config['system']['hostname']), htmlspecialchars($config['system']['domain']));
|
308
|
} else {
|
309
|
$loginbannerstr = sprintf(gettext('Login to %1$s'), $g['product_name']);
|
310
|
}
|
311
|
|
312
|
$loginautocomplete = isset($config['system']['webgui']['loginautocomplete']) ? '' : 'autocomplete="off"';
|
313
|
|
314
|
if (is_ipaddr($http_host) && !$local_ip && !isset($config['system']['webgui']['nohttpreferercheck'])) {
|
315
|
$warnclass = "pagebodywarn"; // Make room for a warning display row
|
316
|
} else {
|
317
|
$warnclass = "pagebody";
|
318
|
}
|
319
|
|
320
|
|
321
|
?>
|
322
|
<!DOCTYPE html>
|
323
|
<html lang="en">
|
324
|
<head>
|
325
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
326
|
<link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css" type="text/css">
|
327
|
<link rel="stylesheet" href="/css/login.css" type="text/css">
|
328
|
<title><?=gettext("Login"); ?></title>
|
329
|
<script type="text/javascript">
|
330
|
//<![CDATA{
|
331
|
var events = events || [];
|
332
|
//]]>
|
333
|
</script>
|
334
|
</head>
|
335
|
|
336
|
<body id="login" >
|
337
|
<div id="total">
|
338
|
<header>
|
339
|
<div id="headerrow">
|
340
|
<div class="row">
|
341
|
<div class="col-sm-4">
|
342
|
<div id="logodiv" style="text-align:center" class="nowarning">
|
343
|
<svg role="img" aria-labelledby="pfsense-logo" x="0px" y="0px" viewBox="0 0 282.8 84.2" width="240" height="100%">
|
344
|
<title id="pfsense-logo-svg">pfSense Logo</title>
|
345
|
<style type="text/css">
|
346
|
.logo-st0{fill:#2B40B5;}
|
347
|
.logo-st1{fill:#1475CF;}
|
348
|
.logo-st2{fill:#1C1275;}
|
349
|
</style>
|
350
|
<path class="logo-st0" d="M27.8,57.7c2.9,0,5.4-0.9,7.5-2.6c2.1-1.7,3.6-4,4.4-6.8c0.8-2.8,0.6-5.1-0.5-6.8c-1.1-1.7-3.2-2.6-6.1-2.6 c-2.9,0-5.4,0.9-7.5,2.6c-2.1,1.7-3.5,4-4.3,6.8c-0.8,2.8-0.7,5.1,0.5,6.8C22.8,56.9,24.8,57.7,27.8,57.7"/>
|
351
|
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,0-0.3-0.1-0.6-0.1h-0.7V68.5z M277,70.6v-3.8h1.3c0.5,0,0.8,0,1,0.1c0.2,0.1,0.4,0.2,0.5,0.4c0.1,0.2,0.2,0.4,0.2,0.6 c0,0.3-0.1,0.5-0.3,0.7c-0.2,0.2-0.5,0.3-0.8,0.3c0.1,0.1,0.2,0.1,0.3,0.2c0.2,0.2,0.3,0.4,0.6,0.8l0.5,0.7h-0.8l-0.3-0.6 c-0.3-0.5-0.5-0.8-0.6-0.9c-0.1-0.1-0.3-0.1-0.5-0.1h-0.4v1.6H277z M278.6,65.7c-0.5,0-1,0.1-1.5,0.4c-0.5,0.3-0.8,0.6-1.1,1.1 c-0.3,0.5-0.4,1-0.4,1.5c0,0.5,0.1,1,0.4,1.5c0.3,0.5,0.6,0.8,1.1,1.1c0.5,0.3,1,0.4,1.5,0.4c0.5,0,1-0.1,1.5-0.4 c0.5-0.3,0.8-0.6,1.1-1.1c0.3-0.5,0.4-1,0.4-1.5c0-0.5-0.1-1-0.4-1.5c-0.3-0.5-0.6-0.8-1.1-1.1C279.6,65.8,279.1,65.7,278.6,65.7z M278.6,65.1c0.6,0,1.2,0.2,1.8,0.5c0.6,0.3,1,0.7,1.3,1.3c0.3,0.6,0.5,1.2,0.5,1.8c0,0.6-0.2,1.2-0.5,1.8c-0.3,0.6-0.8,1-1.3,1.3 c-0.6,0.3-1.2,0.5-1.8,0.5c-0.6,0-1.2-0.2-1.8-0.5c-0.6-0.3-1-0.8-1.3-1.3c-0.3-0.6-0.5-1.2-0.5-1.8c0-0.6,0.2-1.2,0.5-1.8 c0.3-0.6,0.8-1,1.3-1.3C277.4,65.2,278,65.1,278.6,65.1z"/>
|
359
|
</svg>
|
360
|
</div>
|
361
|
</div>
|
362
|
<div class="col-sm-8 nowarning msgbox text-center">
|
363
|
<span id="hostspan">
|
364
|
<a><h4><?=$loginbannerstr?></h4></a>
|
365
|
</span>
|
366
|
</div>
|
367
|
</div>
|
368
|
<?php
|
369
|
if ($warnclass == "pagebodywarn") {
|
370
|
?>
|
371
|
<div class="row">
|
372
|
<div class="col-sm-12">
|
373
|
<div class="alert alert-warning <?=$warnclass?>">
|
374
|
<?=gettext("The IP address being used to access this router is not configured locally, which may be forwarded by NAT or other means.
|
375
|
If this forwarding is unexpected, it should be verified that a man-in-the-middle attack is not taking place.")?>
|
376
|
</div>
|
377
|
</div>
|
378
|
</div>
|
379
|
<?php
|
380
|
}
|
381
|
?>
|
382
|
</div>
|
383
|
</header>
|
384
|
|
385
|
<div style="background: <?=$logincssfile?>;" class="<?=$warnclass?>">
|
386
|
<div class="col-sm-4"></div>
|
387
|
|
388
|
<div class="col-sm-4 offset-md-4 logoCol">
|
389
|
<div class="loginCont center-block">
|
390
|
<form method="post" <?=$loginautocomplete?> class="login">
|
391
|
<p class="form-title">Sign In</p>
|
392
|
<input name="usernamefld" id="usernamefld" type="text" placeholder="Username" autocorrect="off" autocapitalize="none"/>
|
393
|
<input name="passwordfld" id="passwordfld" type="password" placeholder="Password" />
|
394
|
<input type="submit" name="login" value="Sign In" class="btn btn-success btn-sm" />
|
395
|
</form>
|
396
|
</div>
|
397
|
</div>
|
398
|
|
399
|
<div class="col-sm-4"></div>
|
400
|
</div>
|
401
|
|
402
|
<footer id="3">
|
403
|
<div id="footertext">
|
404
|
<p class="text-muted">
|
405
|
<a target="_blank" href="https://www.pfsense.org/?gui=bootstrap">pfSense</a> is ©
|
406
|
2004 - 2017 by <a href="https://pfsense.org/license" class="tblnk">Rubicon Communications, LLC (Netgate)</a>. All Rights Reserved.
|
407
|
[<a href="/license.php" class="tblnk">view license</a>]
|
408
|
</p>
|
409
|
</div>
|
410
|
</footer>
|
411
|
</div>
|
412
|
|
413
|
<script src="/vendor/jquery/jquery-1.12.0.min.js?v=<?=filemtime('/usr/local/www/vendor/jquery/jquery-1.12.0.min.js')?>"></script>
|
414
|
<script src="/vendor/bootstrap/js/bootstrap.min.js?v=<?=filemtime('/usr/local/www/vendor/bootstrap/js/bootstrap.min.js')?>"></script>
|
415
|
<script src="/js/pfSense.js?v=<?=filemtime('/usr/local/www/js/pfSense.js')?>"></script>
|
416
|
|
417
|
<script type="text/javascript">
|
418
|
//!<[CDATA[
|
419
|
events.push(function() {
|
420
|
document.cookie=
|
421
|
"cookie_test=1" +
|
422
|
"<?php echo $config['system']['webgui']['protocol'] == 'https' ? '; secure' : '';?>";
|
423
|
|
424
|
if (document.cookie.indexOf("cookie_test") == -1) {
|
425
|
alert("<?=gettext('The browser must support cookies to login.')?>");
|
426
|
}
|
427
|
|
428
|
// Delete it
|
429
|
document.cookie = "cookie_test=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
|
430
|
});
|
431
|
//]]>
|
432
|
</script>
|
433
|
|
434
|
</body>
|
435
|
</html>
|
436
|
|
437
|
<?php
|
438
|
} // end function
|