more form validation

Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/4e95ff08
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/4e95ff08
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/4e95ff08

Branch: refs/heads/psql
Commit: 4e95ff08fa162871067135e36554ec94605dc6e5
Parents: ef61adb
Author: Jeremy Mitchell <mitchell...@gmail.com>
Authored: Thu Oct 13 14:22:07 2016 -0600
Committer: Jeremy Mitchell <mitchell...@gmail.com>
Committed: Thu Oct 13 14:22:07 2016 -0600

----------------------------------------------------------------------
 .../common/modules/form/asn/form.asn.tpl.html   |  3 +-
 .../form/cacheGroup/form.cacheGroup.tpl.html    |  6 ++-
 .../form.deliveryService.tpl.html               | 28 +++++--------
 .../form/location/FormLocationController.js     |  2 +-
 .../modules/form/server/FormServerController.js | 41 +++++++++++---------
 .../common/modules/form/user/form.user.tpl.html |  5 ++-
 6 files changed, 43 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/asn/form.asn.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/asn/form.asn.tpl.html 
b/traffic_ops/experimental/ui/app/src/common/modules/form/asn/form.asn.tpl.html
index c8e6670..c6603a1 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/asn/form.asn.tpl.html
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/asn/form.asn.tpl.html
@@ -12,9 +12,10 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(asnForm.asn), 'has-feedback': hasError(asnForm.asn)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">ASN 
*</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="asn" name="asn" type="text" 
class="form-control" ng-model="asn.asn" ng-required="true" ng-maxlength="11" 
autofocus>
+                    <input id="asn" name="asn" type="text" 
class="form-control" ng-model="asn.asn" ng-required="true" ng-maxlength="11" 
ng-pattern="/^\d+$/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(asnForm.asn, 'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(asnForm.asn, 'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(asnForm.asn, 'pattern')">Number</small>
                     <span ng-show="hasError(asnForm.asn)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/cacheGroup/form.cacheGroup.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/cacheGroup/form.cacheGroup.tpl.html
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/cacheGroup/form.cacheGroup.tpl.html
index d3fcaf7..f2681b9 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/cacheGroup/form.cacheGroup.tpl.html
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/cacheGroup/form.cacheGroup.tpl.html
@@ -12,18 +12,20 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(cacheGroupForm.name), 'has-feedback': hasError(cacheGroupForm.name)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Name 
*</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="name" name="name" type="text" 
class="form-control" ng-model="cacheGroup.name" ng-required="true" 
ng-maxlength="45" autofocus>
+                    <input id="name" name="name" type="text" 
class="form-control" ng-model="cacheGroup.name" ng-required="true" 
ng-maxlength="45" ng-pattern="/^\S*$/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.name, 'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.name, 'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.name, 'pattern')">No spaces</small>
                     <span ng-show="hasError(cacheGroupForm.name)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>
             <div class="form-group" ng-class="{'has-error': 
hasError(cacheGroupForm.shortName), 'has-feedback': 
hasError(cacheGroupForm.shortName)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Short 
Name *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="shortName" name="shortName" type="text" 
class="form-control" ng-model="cacheGroup.shortName" ng-required="true" 
ng-maxlength="255" autofocus>
+                    <input id="shortName" name="shortName" type="text" 
class="form-control" ng-model="cacheGroup.shortName" ng-required="true" 
ng-maxlength="255" ng-pattern="/^\S*$/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.shortName, 
'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.shortName, 'maxlength')">Too 
Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(cacheGroupForm.shortName, 'pattern')">No 
spaces</small>
                     <span ng-show="hasError(cacheGroupForm.shortName)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryService/form.deliveryService.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryService/form.deliveryService.tpl.html
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryService/form.deliveryService.tpl.html
index fc4b926..e66c966 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryService/form.deliveryService.tpl.html
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/deliveryService/form.deliveryService.tpl.html
@@ -13,7 +13,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.xmlId), 'has-feedback': 
hasError(deliveryServiceForm.xmlId)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">XML 
ID *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="xmlId" name="xmlId" type="text" 
class="form-control" ng-model="deliveryService.xmlId" ng-required="true" 
ng-maxlength="48" ng-pattern="/^[a-zA-Z0-9]*$/" autofocus>
+                    <input id="xmlId" name="xmlId" type="text" 
class="form-control" ng-model="deliveryService.xmlId" ng-required="true" 
ng-maxlength="48" ng-pattern="/^\S*$/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.xmlId, 
'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.xmlId, 'maxlength')">Too 
Long</small>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.xmlId, 'pattern')">No 
spaces</small>
@@ -72,9 +72,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.dscp), 'has-feedback': 
hasError(deliveryServiceForm.dscp)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">DSCP 
Tag *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <select id="dscp" name="dscp" class="form-control" 
ng-model="deliveryService.dscp" ng-options="dcsp.value as dcsp.label for dcsp 
in dscps" required>
-                        <option value="">Select...</option>
-                    </select>
+                    <select id="dscp" name="dscp" class="form-control" 
ng-model="deliveryService.dscp" ng-options="dcsp.value as dcsp.label for dcsp 
in dscps" required></select>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.dscp, 
'required')">Required</small>
                 </div>
             </div>
@@ -98,9 +96,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.geoLimit), 'has-feedback': 
hasError(deliveryServiceForm.geoLimit)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Geo 
Limit *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <select id="geoLimit" name="geoLimit" class="form-control" 
ng-model="deliveryService.geoLimit" ng-options="gl.value as gl.label for gl in 
geoLimits" required>
-                        <option value="">Select...</option>
-                    </select>
+                    <select id="geoLimit" name="geoLimit" class="form-control" 
ng-model="deliveryService.geoLimit" ng-options="gl.value as gl.label for gl in 
geoLimits" required></select>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.geoLimit, 
'required')">Required</small>
                 </div>
             </div>
@@ -117,9 +113,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.geoProvider), 'has-feedback': 
hasError(deliveryServiceForm.geoProvider)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Geo 
Provider *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <select id="geoProvider" name="geoProvider" 
class="form-control" ng-model="deliveryService.geoProvider" 
ng-options="gp.value as gp.label for gp in geoProviders" required>
-                        <option value="">Select...</option>
-                    </select>
+                    <select id="geoProvider" name="geoProvider" 
class="form-control" ng-model="deliveryService.geoProvider" 
ng-options="gp.value as gp.label for gp in geoProviders" required></select>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.geoProvider, 
'required')">Required</small>
                 </div>
             </div>
@@ -127,8 +121,9 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.geolimitRedirectUrl), 'has-feedback': 
hasError(deliveryServiceForm.geolimitRedirectUrl)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Geo 
Limit Redirect URL</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="geolimitRedirectUrl" name="geolimitRedirectUrl" 
type="text" class="form-control" ng-model="deliveryService.geolimitRedirectUrl" 
ng-maxlength="255" autofocus>
+                    <input id="geolimitRedirectUrl" name="geolimitRedirectUrl" 
type="text" class="form-control" ng-model="deliveryService.geolimitRedirectUrl" 
ng-maxlength="255" ng-pattern="/^(https?:\/\/)/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.geolimitRedirectUrl, 
'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.geolimitRedirectUrl, 
'pattern')">Must start with http:// or https://</small>
                     <span 
ng-show="hasError(deliveryServiceForm.geolimitRedirectUrl)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>
@@ -145,9 +140,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.initialDispersion), 'has-feedback': 
hasError(deliveryServiceForm.initialDispersion)}">
                 <label class="control-label col-md-2 col-sm-2 
col-xs-12">Initial Dispersion *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <select id="initialDispersion" name="initialDispersion" 
class="form-control" ng-model="deliveryService.initialDispersion" 
ng-options="disp.value as disp.label for disp in dispersions" required>
-                        <option value="">Select...</option>
-                    </select>
+                    <select id="initialDispersion" name="initialDispersion" 
class="form-control" ng-model="deliveryService.initialDispersion" 
ng-options="disp.value as disp.label for disp in dispersions" required></select>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.initialDispersion, 
'required')">Required</small>
                 </div>
             </div>
@@ -163,9 +156,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.rangeRequestHandling), 'has-feedback': 
hasError(deliveryServiceForm.rangeRequestHandling)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Range 
Request Handling *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <select id="rangeRequestHandling" 
name="rangeRequestHandling" class="form-control" 
ng-model="deliveryService.rangeRequestHandling" ng-options="rrh.value as 
rrh.label for rrh in rrhs" required>
-                        <option value="">Select...</option>
-                    </select>
+                    <select id="rangeRequestHandling" 
name="rangeRequestHandling" class="form-control" 
ng-model="deliveryService.rangeRequestHandling" ng-options="rrh.value as 
rrh.label for rrh in rrhs" required></select>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.rangeRequestHandling, 
'required')">Required</small>
                 </div>
             </div>
@@ -227,8 +218,9 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(deliveryServiceForm.orgServerFqdn), 'has-feedback': 
hasError(deliveryServiceForm.orgServerFqdn)}">
                 <label class="control-label col-md-2 col-sm-2 
col-xs-12">Origin Server Base URL *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="orgServerFqdn" name="orgServerFqdn" type="text" 
class="form-control" ng-model="deliveryService.orgServerFqdn" 
ng-maxlength="255" required autofocus>
+                    <input id="orgServerFqdn" name="orgServerFqdn" type="text" 
class="form-control" ng-model="deliveryService.orgServerFqdn" 
ng-maxlength="255" ng-pattern="/^(https?:\/\/)/" required autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.orgServerFqdn, 'maxlength')">Too 
Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(deliveryServiceForm.orgServerFqdn, 'pattern')">Must 
start with http:// or https://</small>
                     <span 
ng-show="hasError(deliveryServiceForm.orgServerFqdn)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/location/FormLocationController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/location/FormLocationController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/location/FormLocationController.js
index b6a3623..417a614 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/location/FormLocationController.js
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/location/FormLocationController.js
@@ -18,7 +18,7 @@ var FormLocationController = function(location, $scope, 
formUtils, stringUtils,
         { name: 'zip', type: 'text', required: true, maxLength: 5 },
         { name: 'poc', type: 'text', required: false, maxLength: 128 },
         { name: 'phone', type: 'text', required: false, maxLength: 45 },
-        { name: 'email', type: 'text', required: false, maxLength: 128 }
+        { name: 'email', type: 'email', required: false, maxLength: 128 }
     ];
 
     $scope.labelize = stringUtils.labelize;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/server/FormServerController.js
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/server/FormServerController.js
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/server/FormServerController.js
index 7100125..fa7c3f0 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/server/FormServerController.js
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/server/FormServerController.js
@@ -42,32 +42,37 @@ var FormServerController = function(server, $scope, 
formUtils, stringUtils, loca
             });
     };
 
+    // supposedly matches IPv4 and IPv6 formats. but actually need one that 
matches each. todo.
+    var ipRegex = new 
RegExp(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){
 
3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/);
+
     $scope.server = server;
 
     $scope.props = [
-        { name: 'hostName', type: 'text', required: true, maxLength: 45 },
-        { name: 'domainName', type: 'text', required: true, maxLength: 45 },
-        { name: 'tcpPort', type: 'number', required: false, maxLength: 10 },
+        { name: 'hostName', type: 'text', required: true, maxLength: 45, 
pattern: new RegExp(/^\S*$/), invalidMsg: 'No Spaces' },
+        { name: 'domainName', type: 'text', required: true, maxLength: 45, 
pattern: new RegExp(/^\S*$/), invalidMsg: 'No Spaces' },
+        { name: 'tcpPort', type: 'text', required: false, maxLength: 10, 
pattern: new RegExp(/^\d+$/), invalidMsg: 'Number' },
         { name: 'xmppId', type: 'text', required: false, maxLength: 256 },
         { name: 'xmppPasswd', type: 'text', required: false, maxLength: 45 },
         { name: 'interfaceName', type: 'text', required: true, maxLength: 45 },
-        { name: 'ipAddress', type: 'text', required: true, maxLength: 45 },
-        { name: 'ipNetmask', type: 'text', required: true, maxLength: 45 },
-        { name: 'ipGateway', type: 'text', required: true, maxLength: 45 },
-        { name: 'ip6Address', type: 'text', required: false, maxLength: 50 },
-        { name: 'ip6Gateway', type: 'text', required: false, maxLength: 50 },
-        { name: 'interfaceMtu', type: 'number', required: true, maxLength: 11, 
pattern: new RegExp('(^1500$|^9000$)'), invalidMsg: '1500 or 9000' },
+        { name: 'ipAddress', type: 'text', required: true, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'ipNetmask', type: 'text', required: true, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'ipGateway', type: 'text', required: true, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'ip6Address', type: 'text', required: false, maxLength: 50, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'ip6Gateway', type: 'text', required: false, maxLength: 50, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'interfaceMtu', type: 'text', required: true, maxLength: 11, 
pattern: new RegExp(/(^1500$|^9000$)/), invalidMsg: '1500 or 9000' },
         { name: 'rack', type: 'text', required: false, maxLength: 64 },
-        { name: 'mgmtIpAddress', type: 'text', required: false, maxLength: 50 
},
-        { name: 'mgmtIpNetmask', type: 'text', required: false, maxLength: 45 
},
-        { name: 'mgmtIpGateway', type: 'text', required: false, maxLength: 45 
},
-        { name: 'iloIpAddress', type: 'text', required: false, maxLength: 45 },
-        { name: 'iloIpNetmask', type: 'text', required: false, maxLength: 45 },
-        { name: 'iloIpGateway', type: 'text', required: false, maxLength: 45 },
-        { name: 'iloUsername', type: 'text', required: false, maxLength: 45 },
+        { name: 'offlineReason', type: 'text', required: false, maxLength: 256 
},
+        { name: 'mgmtIpAddress', type: 'text', required: false, maxLength: 50, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'mgmtIpNetmask', type: 'text', required: false, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'mgmtIpGateway', type: 'text', required: false, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'iloIpAddress', type: 'text', required: false, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'iloIpNetmask', type: 'text', required: false, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'iloIpGateway', type: 'text', required: false, maxLength: 45, 
pattern: ipRegex, invalidMsg: 'Invalid' },
+        { name: 'iloUsername', type: 'text', required: false, maxLength: 45, 
pattern: new RegExp(/^\S*$/), invalidMsg: 'No Spaces' },
         { name: 'iloPassword', type: 'text', required: false, maxLength: 45 },
-        { name: 'routerHostName', type: 'text', required: false, maxLength: 
256 },
-        { name: 'routerPortName', type: 'text', required: false, maxLength: 
256 }
+        { name: 'routerHostName', type: 'text', required: false, maxLength: 
256, pattern: new RegExp(/^\S*$/), invalidMsg: 'No Spaces' },
+        { name: 'routerPortName', type: 'text', required: false, maxLength: 
256 },
+        { name: 'httpsPort', type: 'text', required: false, maxLength: 10, 
pattern: new RegExp(/^\d+$/), invalidMsg: 'Number' },
     ];
 
     $scope.labelize = stringUtils.labelize;

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/4e95ff08/traffic_ops/experimental/ui/app/src/common/modules/form/user/form.user.tpl.html
----------------------------------------------------------------------
diff --git 
a/traffic_ops/experimental/ui/app/src/common/modules/form/user/form.user.tpl.html
 
b/traffic_ops/experimental/ui/app/src/common/modules/form/user/form.user.tpl.html
index 9d9a442..819a2b4 100644
--- 
a/traffic_ops/experimental/ui/app/src/common/modules/form/user/form.user.tpl.html
+++ 
b/traffic_ops/experimental/ui/app/src/common/modules/form/user/form.user.tpl.html
@@ -32,7 +32,7 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(userForm.email), 'has-feedback': hasError(userForm.email)}">
                 <label class="control-label col-md-2 col-sm-2 col-xs-12">Email 
*</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="email" name="email" type="text" 
class="form-control" ng-model="user.email" ng-required="true" 
ng-maxlength="128" autofocus>
+                    <input id="email" name="email" type="email" 
class="form-control" ng-model="user.email" ng-required="true" 
ng-maxlength="128" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(userForm.email, 'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(userForm.email, 'maxlength')">Too Long</small>
                     <span ng-show="hasError(userForm.email)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
@@ -41,9 +41,10 @@
             <div class="form-group" ng-class="{'has-error': 
hasError(userForm.username), 'has-feedback': hasError(userForm.username)}">
                 <label class="control-label col-md-2 col-sm-2 
col-xs-12">Username *</label>
                 <div class="col-md-10 col-sm-10 col-xs-12">
-                    <input id="username" name="username" type="text" 
class="form-control" ng-model="user.username" ng-required="true" 
ng-maxlength="128" autofocus>
+                    <input id="username" name="username" type="text" 
class="form-control" ng-model="user.username" ng-required="true" 
ng-maxlength="128" ng-pattern="/^\S*$/" autofocus>
                     <small class="input-error" 
ng-show="hasPropertyError(userForm.username, 'required')">Required</small>
                     <small class="input-error" 
ng-show="hasPropertyError(userForm.username, 'maxlength')">Too Long</small>
+                    <small class="input-error" 
ng-show="hasPropertyError(userForm.username, 'pattern')">No Spaces</small>
                     <span ng-show="hasError(userForm.username)" 
class="form-control-feedback"><i class="fa fa-times"></i></span>
                 </div>
             </div>

Reply via email to