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

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jul 2 14:44:03 CEST 2018


On 6/29/18 1:08 PM, Thomas Lamprecht wrote:
> 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();
>  		    }
>  		}
>  	    },
> 

applied series with a slightly modified 3/3 - I keep the field
balance now, i.e., the Domain field is still on the right side.
Much thanks to Wolfgang for his test/review!




More information about the pve-devel mailing list