76 |
76 |
return;
|
77 |
77 |
}
|
78 |
78 |
|
79 |
|
$cpsession = captiveportal_isip_logged($clientip);
|
80 |
79 |
$ourhostname = portal_hostname_from_client_ip($clientip);
|
|
80 |
$protocol = (isset($config['captiveportal'][$cpzone]['httpslogin'])) ? 'https://' : 'http://';
|
|
81 |
$logouturl = "{$protocol}{$ourhostname}/";
|
|
82 |
|
|
83 |
$cpsession = captiveportal_isip_logged($clientip);
|
|
84 |
if (!empty($cpsession)) {
|
|
85 |
$sessionid = $cpsession['sessionid'];
|
|
86 |
}
|
|
87 |
|
81 |
88 |
/* Automatically switching to the logout page requires a custom logout page to be present. */
|
82 |
89 |
if ((!empty($cpsession)) && (! $_POST['logout_id']) && (!empty($cpcfg['page']['logouttext']))) {
|
83 |
90 |
/* if client already connected and a custom logout page is set : show logout page */
|
84 |
|
$protocol = (isset($config['captiveportal'][$cpzone]['httpslogin'])) ? 'https://' : 'http://';
|
85 |
|
$logouturl = "{$protocol}{$ourhostname}/";
|
86 |
|
|
87 |
|
$sessionid = $cpsession['sessionid'];
|
88 |
91 |
$attributes = array();
|
89 |
92 |
if (!empty($cpsession['session_timeout']))
|
90 |
93 |
$attributes['session_timeout'] = $cpsession['session_timeout'];
|
... | ... | |
94 |
97 |
include("{$g['varetc_path']}/captiveportal-{$cpzone}-logout.html");
|
95 |
98 |
ob_flush();
|
96 |
99 |
return;
|
97 |
|
} elseif (!empty($cpsession) && (!isset($_POST['logout_id']) || !isset($config['captiveportal'][$cpzone]['logoutwin_enable']))) {
|
98 |
|
/* If client try to access captive portal page while already connected,
|
99 |
|
but no custom logout page does exist and logout popup is disabled */
|
100 |
|
echo gettext("You are connected.<br/>");
|
101 |
|
if (!empty($redirurl)) {
|
102 |
|
$redirurl = htmlspecialchars($redirurl);
|
103 |
|
echo ("You can proceed to: <a href='{$redirurl}'>{$redirurl}</a>");
|
104 |
|
}
|
|
100 |
} elseif (!empty($cpsession) && !isset($_POST['logout_id'])) {
|
|
101 |
/* If the client tries to access the captive portal page while already connected,
|
|
102 |
but no custom logout page exists */
|
|
103 |
$logo_src = get_captive_portal_logo();
|
|
104 |
$bg_src = get_captive_portal_bg();
|
|
105 |
?>
|
|
106 |
<!DOCTYPE html>
|
|
107 |
<html>
|
|
108 |
<head>
|
|
109 |
<meta charset="UTF-8">
|
|
110 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
111 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
112 |
<title>Captive Portal</title>
|
|
113 |
<style>
|
|
114 |
#content,.login,.login-card a,.login-card h1,.login-help{text-align:center}body,html{margin:0;padding:0;width:100%;height:100%;display:table}#content{font-family:'Source Sans Pro',sans-serif;background-color:#1C1275;background:<?= $bg_src ?>;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;display:table-cell;vertical-align:middle}.login-card{padding:40px;width:280px;background-color:#F7F7F7;margin:100px auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}.login-card h1{font-weight:400;font-size:2.3em;color:#1383c6}.login-card h1 span{color:#f26721}.login-card img{width:70%;height:70%}.login-card input[type=submit]{width:100%;display:block;margin-bottom:10px;position:relative}.login-card input[type=text],input[type=password]{height:44px;font-size:16px;width:100%;margin-bottom:10px;-webkit-appearance:none;background:#fff;border:1px solid #d9d9d9;border-top:1px solid silver;padding:0 8px;box-sizing:border-box;-moz-box-sizing:border-box}.login-card input[type=text]:hover,input[type=password]:hover{border:1px solid #b9b9b9;border-top:1px solid #a0a0a0;-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.login{font-size:14px;font-family:Arial,sans-serif;font-weight:700;height:36px;padding:0 8px}.login-submit{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;color:#fff;text-shadow:0 1px rgba(0,0,0,.1);background-color:#4d90fe}.login-submit:disabled{opacity:.6}.login-submit:hover{border:0;text-shadow:0 1px rgba(0,0,0,.3);background-color:#357ae8}.login-card a{text-decoration:none;color:#222;font-weight:400;display:inline-block;opacity:.6;transition:opacity ease .5s}.login-card a:hover{opacity:1}.login-help{width:100%;font-size:12px}.list{list-style-type:none;padding:0}.list__item{margin:0 0 .7rem;padding:0}label{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;text-align:left;font-size:14px;}input[type=checkbox]{-webkit-box-flex:0;-webkit-flex:none;-ms-flex:none;flex:none;margin-right:10px;float:left}@media screen and (max-width:450px){.login-card{width:70%!important}.login-card img{width:30%;height:30%}}textarea{width:66%;margin:auto;height:120px;max-height:120px;background-color:#f7f7f7;padding:20px}#terms{display:none;padding-top:100px;padding-bottom:300px;}.auth_source{border: 1px solid lightgray; padding:20px 8px 0px 8px; margin-top: -2em; border-radius: 2px; }.auth_head{background-color:#f7f7f7;display:inline-block;}.auth_head_div{text-align:left;}#error-message{text-align:left;color:#ff3e3e;font-style:italic;}
|
|
115 |
</style>
|
|
116 |
</head>
|
|
117 |
|
|
118 |
<body>
|
|
119 |
<div id="content">
|
|
120 |
<div class="login-card">
|
|
121 |
<img src="<?= $logo_src ?>"/><br>
|
|
122 |
<h1></h1>
|
|
123 |
<div class="login-help">
|
|
124 |
<?= gettext("The portal session is connected.") ?>
|
|
125 |
<?php if (!empty($redirurl)):
|
|
126 |
$redirurl = htmlspecialchars($redirurl); ?>
|
|
127 |
<br/><br/>
|
|
128 |
<?= gettext("Proceed to: ") ?>
|
|
129 |
<a href="<?=$redirurl?>"><?=$redirurl?></a>
|
|
130 |
<?php endif; ?>
|
|
131 |
</div>
|
|
132 |
<br/>
|
|
133 |
<form method="POST" action="<?=$logouturl;?>">
|
|
134 |
<input name="logout_id" type="hidden" value="<?=$sessionid;?>" />
|
|
135 |
<input name="zone" type="hidden" value="<?=$cpzone;?>" />
|
|
136 |
<input name="logout" type="submit" value="<?= gettext("Disconnect") ?>" />
|
|
137 |
</form>
|
|
138 |
<br />
|
|
139 |
<span> <i>Made with ♥ by</i> <strong>Netgate</strong></span>
|
|
140 |
</div>
|
|
141 |
</div>
|
|
142 |
</body>
|
|
143 |
</html>
|
|
144 |
<?php
|
105 |
145 |
ob_flush();
|
106 |
146 |
return;
|
107 |
147 |
} elseif ($orig_host != $ourhostname) {
|
... | ... | |
135 |
175 |
$safe_logout_id = SQLite3::escapeString($_POST['logout_id']);
|
136 |
176 |
captiveportal_disconnect_client($safe_logout_id);
|
137 |
177 |
header("Location: index.php?zone=".$cpzone);
|
|
178 |
ob_flush();
|
|
179 |
return;
|
138 |
180 |
} elseif (($_POST['accept'] || $cpcfg['auth_method'] === 'radmac' || !empty($cpcfg['blockedmacsurl'])) && $macfilter && $clientmac && captiveportal_blocked_mac($clientmac)) {
|
139 |
181 |
captiveportal_logportalauth($clientmac, $clientmac, $clientip, "Blocked MAC address");
|
140 |
182 |
if (!empty($cpcfg['blockedmacsurl'])) {
|
Portal logout updates. Fixes #12138
experience
URL no matter the setting of the logout popup option