summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/firewall_nat_edit.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-12-06 23:08:17 +0545
committerRenato Botelho <renato@netgate.com>2016-12-07 16:09:39 -0200
commit823b7a1a7df7c523b7c98341dc285f0afd9c67bc (patch)
tree0d5f72ebfc7731a7a5170d08a1d39d9f3678081e /src/usr/local/www/firewall_nat_edit.php
parentbb0a0bb2648b08ce5453208753e25fb052b16f12 (diff)
downloadpfsense-823b7a1a7df7c523b7c98341dc285f0afd9c67bc.zip
pfsense-823b7a1a7df7c523b7c98341dc285f0afd9c67bc.tar.gz
Fix #6224 NAT edit - preserve user selections when input errors
1) Edit a NAT Port Forward rule, change the destination type to "Network", but do not input any network address/mask. 2) Press Save, an input error is reported telling that the network destination address/mask is required - good. However, the destination type is no longer "Network" - it goes to "xxx address" where "xxx" is the selected interface. The problem is that JS dst_change() is being called on every page load. That is good when starting a new entry (the Destination gets set to WAN address to match the default interface of WAN), or when starting to edit an existing entry (the code runs without messing anything up). But when data has been $_POSTed and there are input errors, we just want to redisplay whatever the user had selected, not go trying to fix up correlations between fields. (cherry picked from commit f7405cd2f750e20735aa7b584c0f322e9e0f6cc6)
Diffstat (limited to 'src/usr/local/www/firewall_nat_edit.php')
-rw-r--r--src/usr/local/www/firewall_nat_edit.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 927f650..fe5b614 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -1269,7 +1269,13 @@ events.push(function() {
hideSource(!srcenabled);
ext_change();
+<?php
+if (!$_POST) {
+?>
dst_change($('#interface').val(),'<?=htmlspecialchars($pconfig['interface'])?>','<?=htmlspecialchars($pconfig['dst'])?>');
+<?php
+}
+?>
iface_old = $('#interface').val();
typesel_change();
proto_change();
OpenPOWER on IntegriCloud