From 61c21213b282f9182eb3ddb5a709086aff311d22 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 12 Aug 2020 18:08:09 +0000 Subject: [IMP] web: allow password fields to force the `autocomplete` value Follow-up on 6edb7495346119e2ceb25f5b5b5568b4b890dd86, where default `autocomplete` values were introduced as default for password fields, according to the new autofill specs. This patch allows developers to force the "autocomplete" attribute value on password fields, in case there really is a need for a value that is not `new-password` (which BTW now triggers the password generator wizard in many browsers). It is useful for example when a backend form really needs to ask the user for their current password, so the correct `autocomplete` value is `current-password`, as on the login form. --- addons/web/static/src/js/fields/basic_fields.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 252ef70894e..3e49fdbf250 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -262,7 +262,7 @@ var InputField = DebouncedField.extend({ var inputAttrs = { placeholder: this.attrs.placeholder || "" }; var inputVal; if (this.nodeOptions.isPassword) { - inputAttrs = _.extend(inputAttrs, { type: 'password', autocomplete: 'new-password' }); + inputAttrs = _.extend(inputAttrs, { type: 'password', autocomplete: this.attrs.autocomplete || 'new-password' }); inputVal = this.value || ''; } else { inputAttrs = _.extend(inputAttrs, { type: 'text', autocomplete: this.attrs.autocomplete || 'none'}); -- cgit v1.2.3