[pve-devel] [PATCH] Add Search domain validation in node DNS settings

Damien PIQUET piqudam at gmail.com
Fri Mar 1 21:45:17 CET 2013


Signed-off-by: Damien PIQUET <piqudam at gmail.com>
---
 www/manager/node/DNSEdit.js |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/www/manager/node/DNSEdit.js b/www/manager/node/DNSEdit.js
index d402ef5..21015b6 100644
--- a/www/manager/node/DNSEdit.js
+++ b/www/manager/node/DNSEdit.js
@@ -15,7 +15,14 @@ Ext.define('PVE.node.DNSEdit', {
 		xtype: 'textfield',
                 fieldLabel: 'Search domain',
                 name: 'search',
-                allowBlank: false
+                allowBlank: false,
+		validator: function(value) {
+		   var domainre = /^[a-zA-Z0-9\-.]+$/;
+		   if(value && !domainre.test(value)) {
+		      return "Search domain contains invalid characters !";
+		   }
+		   return true;
+		}
 	    },
 	    {
 		xtype: 'pvetextfield',
-- 
1.7.10.4




More information about the pve-devel mailing list