From 5dc32e5877f7cd8bb96ef6becc9a9370490a1c15 Mon Sep 17 00:00:00 2001 From: Alexander Marx Date: Thu, 4 Feb 2016 13:26:35 +0100 Subject: [PATCH] Captive-Portal: add Errormessage when wrong code is entered Signed-off-by: Alexander Marx --- html/cgi-bin/captive/index.cgi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/html/cgi-bin/captive/index.cgi b/html/cgi-bin/captive/index.cgi index 34908bd63c..30fd055d8b 100755 --- a/html/cgi-bin/captive/index.cgi +++ b/html/cgi-bin/captive/index.cgi @@ -85,7 +85,7 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'gpl i accept these terms and conditions' if ($cgiparams{'ACTION'} eq "$Lang::tr{'Captive activate'}"){ my $ip_address; my $mac_address; - + my $granted=0; #Convert voucherinput to uppercase $cgiparams{'VOUCHER'} = uc $cgiparams{'VOUCHER'}; #Get Clients IP-Address @@ -114,11 +114,16 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'Captive activate'}"){ delete $voucherhash{$key}; &General::writehasharray("$voucherout", \%voucherhash); + $granted=1; last; } } - system("/usr/local/bin/captivectrl"); - $redir=1; + if($granted==1){ + system("/usr/local/bin/captivectrl"); + $redir=1; + }else{ + $errormessage="$Lang::tr{'Captive invalid_voucher'}"; + } } if($redir == 1){ @@ -145,7 +150,7 @@ sub start(){ sub error(){ if ($errormessage){ - print "

$errormessage
"; + print "

$errormessage

"; } } @@ -158,13 +163,13 @@ Content-type: text/html\n\n $settings{'TITLE'} + END ; } sub agb(){ print<

$settings{'TITLE'}

@@ -192,7 +197,6 @@ END sub voucher(){ print<

$settings{'TITLE'}

-- 2.39.2