[pve-devel] [PATCH manager 1/3] ui/storage: cifs: only allow entering a password if user is set

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jun 29 13:08:17 CEST 2018


we ignore the password in the backend if no user is passed,
which can be very confusing for the user - or more important, me,
when testing cifs/storage stuff.

So change the mechanics slightly. Previously we changed the
allowBlank property of the password field if username was changed.
I set it to always required, but disable the whole field if we do not
have a username.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 www/manager6/storage/CIFSEdit.js | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/www/manager6/storage/CIFSEdit.js b/www/manager6/storage/CIFSEdit.js
index 941c48ed..d982ef86 100644
--- a/www/manager6/storage/CIFSEdit.js
+++ b/www/manager6/storage/CIFSEdit.js
@@ -88,7 +88,8 @@ Ext.define('PVE.storage.CIFSInputPanel', {
 	    name: 'password',
 	    value: me.isCreate ? '' : '********',
 	    fieldLabel: gettext('Password'),
-	    allowBlank: true,
+	    allowBlank: false,
+	    disabled: me.isCreate,
 	    minLength: 1,
 	    listeners: {
 		change: function(f, value) {
@@ -129,13 +130,14 @@ Ext.define('PVE.storage.CIFSInputPanel', {
 			if (me.isCreate) {
 			    var exportField = me.down('field[name=share]');
 			    exportField.setUsername(value);
+
+			    if (value == "") {
+				passwordfield.disable();
+			    } else {
+				passwordfield.enable();
+			    }
+			    passwordfield.validate();
 			}
-			if (value == "") {
-			    passwordfield.allowBlank = true;
-			} else {
-			    passwordfield.allowBlank = false;
-			}
-			passwordfield.validate();
 		    }
 		}
 	    },
-- 
2.17.1




More information about the pve-devel mailing list