summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/classes
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-11-14 00:02:40 +0545
committerPhil Davis <phil.davis@inf.org>2016-11-14 00:02:40 +0545
commit9444a281f051e11d5456cc37b2a3f56fc8a7bc33 (patch)
treeef6500fc4077628a9f77a7458ebedd9ff1bc7ef9 /src/usr/local/www/classes
parentfbb652ed28641c50b14b9897a914ed317c323d73 (diff)
downloadpfsense-9444a281f051e11d5456cc37b2a3f56fc8a7bc33.zip
pfsense-9444a281f051e11d5456cc37b2a3f56fc8a7bc33.tar.gz
Fix #6918 Allow aliases with capital letters in rules
Expand the types of Form_IpAddress so that the caller can specify exactly what combination of IPv4, IPv6 address and alias is allowed for the field. Set the appropriate input pattern and hover help text. Only toLowercase() the entered value if it has a ":" in it - i.e. it looks like it is intended to be an IPv6 address (rather than an IPv4 or an alias name).
Diffstat (limited to 'src/usr/local/www/classes')
-rw-r--r--src/usr/local/www/classes/Form/IpAddress.class.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/usr/local/www/classes/Form/IpAddress.class.php b/src/usr/local/www/classes/Form/IpAddress.class.php
index 812a2f7..82416f1 100644
--- a/src/usr/local/www/classes/Form/IpAddress.class.php
+++ b/src/usr/local/www/classes/Form/IpAddress.class.php
@@ -45,6 +45,23 @@ class Form_IpAddress extends Form_Input
$this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1';
$this->_attributes['onChange'] = 'javascript:this.value=this.value.toLowerCase();';
break;
+
+ case "ALIASV4V6":
+ $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+';
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an IPv6 address like 1:2a:3b:ffff::1 or an alias';
+ $this->_attributes['onChange'] = 'javascript:if (this.value.indexOf(":") > -1) {this.value=this.value.toLowerCase();}';
+ break;
+
+ case "ALIASV4":
+ $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+';
+ $this->_attributes['title'] = 'An IPv4 address like 1.2.3.4 or an alias';
+ break;
+
+ case "ALIASV6":
+ $this->_attributes['pattern'] = '[a-zA-Z0-9_.:]+';
+ $this->_attributes['title'] = 'An IPv6 address like 1:2a:3b:ffff::1 or an alias';
+ $this->_attributes['onChange'] = 'javascript:if (this.value.indexOf(":") > -1) {this.value=this.value.toLowerCase();}';
+ break;
}
}
OpenPOWER on IntegriCloud