[pve-devel] [PATCH] bugfix #301 Add container hostname validation in GUI

Damien PIQUET piqudam at gmail.com
Thu Feb 28 22:39:46 CET 2013


Signed-off-by: Damien PIQUET <piqudam at gmail.com>
---
 www/manager/openvz/CreateWizard.js |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/www/manager/openvz/CreateWizard.js b/www/manager/openvz/CreateWizard.js
index d30f743..28f0114 100644
--- a/www/manager/openvz/CreateWizard.js
+++ b/www/manager/openvz/CreateWizard.js
@@ -87,7 +87,14 @@ Ext.define('PVE.openvz.CreateWizard', {
 			    value: '',
 			    fieldLabel: 'Hostname',
 			    skipEmptyText: true,
-			    allowBlank: true
+			    allowBlank: true,
+			    validator: function(value) {
+				var hostnamere = /^[a-zA-Z0-9\-.]+$/;
+				if (value && !hostnamere.test(value)) {
+				    return "Hostname contains invalid characters !";
+				}
+				return true;
+			    }
 			}
 		    ],
 		    column2: [
@@ -124,7 +131,7 @@ Ext.define('PVE.openvz.CreateWizard', {
 			    validator: function(value) {
 				var pw = me.down('field[name=password]').getValue();
 				if (pw !== value) {
-				    return "Passowords does not match!";
+				    return "Passwords does not match!";
 				}
 				return true;
 			    }
-- 
1.7.10.4




More information about the pve-devel mailing list