]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: cifs: make user and password independent from each other
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 1 Jul 2020 10:01:31 +0000 (12:01 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 1 Jul 2020 10:02:34 +0000 (12:02 +0200)
the guest account can be password protected, as can a user have no
password - so don't enforce either if the other is set.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/storage/CIFSEdit.js

index 7a8034adc58710366360e88f3618692e214c3b21..172d33046555158764f9d9f0811930fee59bfa27 100644 (file)
@@ -21,11 +21,12 @@ Ext.define('PVE.storage.CIFSScan', {
        }
 
        var params = {};
-       if (me.cifsUsername && me.cifsPassword) {
-           params.username =  me.cifsUsername;
+       if (me.cifsUsername) {
+           params.username = me.cifsUsername;
+       }
+       if (me.cifsPassword) {
            params.password = me.cifsPassword;
        }
-
        if (me.cifsDomain) {
            params.domain = me.cifsDomain;
        }
@@ -122,24 +123,6 @@ Ext.define('PVE.storage.CIFSInputPanel', {
     initComponent: function() {
        var me = this;
 
-       var passwordfield = Ext.createWidget(me.isCreate ? 'textfield' : 'displayfield', {
-           inputType: 'password',
-           name: 'password',
-           value: me.isCreate ? '' : '********',
-           fieldLabel: gettext('Password'),
-           allowBlank: false,
-           disabled: me.isCreate,
-           minLength: 1,
-           listeners: {
-               change: function(f, value) {
-                   if (me.isCreate) {
-                       var exportField = me.down('field[name=share]');
-                       exportField.setPassword(value);
-                   }
-               },
-           },
-       });
-
        me.column1 = [
            {
                xtype: me.isCreate ? 'textfield' : 'displayfield',
@@ -162,7 +145,6 @@ Ext.define('PVE.storage.CIFSInputPanel', {
                value: '',
                fieldLabel: gettext('Username'),
                emptyText: gettext('Guest user'),
-               allowBlank: true,
                listeners: {
                    change: function(f, value) {
                        if (!me.isCreate) {
@@ -170,17 +152,24 @@ Ext.define('PVE.storage.CIFSInputPanel', {
                        }
                        var exportField = me.down('field[name=share]');
                        exportField.setUsername(value);
-
-                       if (value === "") {
-                           passwordfield.disable();
-                       } else {
-                           passwordfield.enable();
-                       }
-                       passwordfield.validate();
                    },
                },
            },
-           passwordfield,
+           {
+               xtype: me.isCreate ? 'textfield' : 'displayfield',
+               inputType: 'password',
+               name: 'password',
+               value: me.isCreate ? '' : '********',
+               emptyText: me.isCreate ? gettext('None') : '',
+               fieldLabel: gettext('Password'),
+               minLength: 1,
+               listeners: {
+                   change: function(f, value) {
+                       let exportField = me.down('field[name=share]');
+                       exportField.setPassword(value);
+                   },
+               },
+           },
            {
                xtype: me.isCreate ? 'pveCIFSScan' : 'displayfield',
                name: 'share',