summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_captiveportal_vouchers.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-07-13 10:53:03 +0545
committerPhil Davis <phil.davis@inf.org>2015-07-13 10:53:03 +0545
commit5eabad3db3cd1f39596f2e682167e1ea2e81326e (patch)
tree8db96352c776c0e452a01a2a66ec13b1bdeeabe3 /usr/local/www/services_captiveportal_vouchers.php
parentfd29caa1c8bc3aa547c50e4842aecd7314cc8d89 (diff)
downloadpfsense-5eabad3db3cd1f39596f2e682167e1ea2e81326e.zip
pfsense-5eabad3db3cd1f39596f2e682167e1ea2e81326e.tar.gz
Cancel button after input error
If there is an input error then the edit page is redrawn showing the input errors. The HTTP_REFERER becomes the current page, rather than the true original referer. Then if you click Cancel the current page is just redrawn. This change makes the code remember the original referer, so if the user enters some invalid data, presses Save, reads the input error messages then presses Cancel they are taken back out to the original page - the same as if Cancel was used before Save.
Diffstat (limited to 'usr/local/www/services_captiveportal_vouchers.php')
-rw-r--r--usr/local/www/services_captiveportal_vouchers.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/local/www/services_captiveportal_vouchers.php b/usr/local/www/services_captiveportal_vouchers.php
index decea80..0bc7dae 100644
--- a/usr/local/www/services_captiveportal_vouchers.php
+++ b/usr/local/www/services_captiveportal_vouchers.php
@@ -50,7 +50,11 @@ require("shaper.inc");
require("captiveportal.inc");
require_once("voucher.inc");
-$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_captiveportal_vouchers.php');
+if (isset($_POST['referer'])) {
+ $referer = $_POST['referer'];
+} else {
+ $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/services_captiveportal_vouchers.php');
+}
$cpzone = $_GET['zone'];
if (isset($_POST['zone'])) {
@@ -683,6 +687,7 @@ function enable_change(enable_change) {
<input type="hidden" name="exponent" id="exponent" value="<?=$pconfig['exponent'];?>" />
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true); before_save();" />
<input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='<?=$referer;?>'" />
+ <input name="referer" type="hidden" value="<?=$referer;?>" />
</td>
</tr>
<tr>
OpenPOWER on IntegriCloud