captive: Allow selecting the session expiry time for terms

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2017-04-26 16:44:27 +01:00
parent 297ebdd47b
commit 278309b9ef
11 changed files with 89 additions and 3 deletions

View File

@@ -31,6 +31,8 @@ require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
my %selected = ();
my $coupons = "${General::swroot}/captive/coupons";
my %couponhash = ();
@@ -74,6 +76,7 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){
$settings{'TITLE'} = $cgiparams{'TITLE'};
$settings{'UNLIMITED'} = $cgiparams{'UNLIMITED'};
$settings{'COLOR'} = $cgiparams{'COLOR'};
$settings{'SESSION_TIME'} = $cgiparams{'SESSION_TIME'};
if (!$errormessage){
#Check if we need to upload a new logo
@@ -291,6 +294,14 @@ END
END
;
if ($settings{'AUTH'} eq 'TERMS') {
$selected{'SESSION_TIME'} = ();
$selected{'SESSION_TIME'}{'0'} = "";
$selected{'SESSION_TIME'}{'3600'} = "";
$selected{'SESSION_TIME'}{'86400'} = "";
$selected{'SESSION_TIME'}{'604800'} = "";
$selected{'SESSION_TIME'}{'18144000'} = "";
$selected{'SESSION_TIME'}{$settings{'SESSION_TIME'}} = "selected";
my $terms = &getterms();
print <<END;
<tr>
@@ -299,6 +310,19 @@ END
<textarea cols="50" rows="10" name="TERMS">$terms</textarea>
</td>
</tr>
<tr>
<td>$Lang::tr{'Captive client session expiry time'}</td>
<td>
<select name="SESSION_TIME">
<option value="0" $selected{'SESSION_TIME'}{'0'}>- $Lang::tr{'unlimited'} -</option>
<option value="3600" $selected{'SESSION_TIME'}{'3600'}>$Lang::tr{'one hour'}</option>
<option value="86400" $selected{'SESSION_TIME'}{'86400'}>$Lang::tr{'24 hours'}</option>
<option value="604800" $selected{'SESSION_TIME'}{'604800'}>$Lang::tr{'one week'}</option>
<option value="18144000" $selected{'SESSION_TIME'}{'18144000'}>$Lang::tr{'one month'}</option>
</select>
</td>
</tr>
END
}

View File

@@ -112,8 +112,8 @@ if ($cgiparams{'ACTION'} eq "SUBMIT") {
# License
} else {
# Copy expiry time
$clientshash{$key}[3] = $settings{'EXPIRE'};
# Copy session expiry time
$clientshash{$key}[3] = $settings{'SESSION_TIME'} || "0";
# No coupon code
$clientshash{$key}[4] = "LICENSE";