Commit 4f812cf4 authored by Ad Schellevis's avatar Ad Schellevis

fix hard/soft timeout for captive portal

parent 2b3d05d1
......@@ -101,7 +101,7 @@ function captiveportal_remove_entries($remove) {
}
function portal_allow($clientip,$clientmac,$username,$password = null, $attributes = null, $pipeno = null, $radiusctx = null) {
global $cpzone ,$type,$g;
global $config, $cpzone ,$type,$g;
$cpc = new OPNsense\CaptivePortal\CPClient();
......@@ -119,11 +119,26 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut
$dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0;
$bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up;
$bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down;
$session_timeout = (!empty($attributes['session_timeout'])) ? $attributes['session_timeout'] : 'NULL';
$idle_timeout = (!empty($attributes['idle_timeout'])) ? $attributes['idle_timeout'] : 'NULL';
$session_terminate_time = (!empty($attributes['session_terminate_time'])) ? $attributes['session_terminate_time'] : 'NULL';
$interim_interval = (!empty($attributes['interim_interval'])) ? $attributes['interim_interval'] : 'NULL';
$session_timeout = 0 ;
if ( array_key_exists("session_timeout",$attributes ) ){
$session_timeout = $attributes['session_timeout'] ;
}
elseif ( is_numeric($config['captiveportal'][$cpzone]["timeout"]) ){
$session_timeout = $config['captiveportal'][$cpzone]["timeout"];
}
$idle_timeout = 0 ;
if ( array_key_exists("idle_timeout",$attributes ) ){
$idle_timeout = $attributes['idle_timeout'] ;
}
elseif ( is_numeric($config['captiveportal'][$cpzone]["idletimeout"]) ){
$idle_timeout = $config['captiveportal'][$cpzone]["idletimeout"];
}
if ($attributes['voucher']) {
$db = new OPNsense\Captiveportal\DB($cpzone);
$clients = $db->listClients(array("username"=>$username), null, null);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment