This is an extension for @Wojciech Marciniak's answer. His approach worked for me, but I want to point out a couple or three modifications that I had to make for it to work from 2017/11/28.
1) autocomplete="off" now does not seem to work anymore; at least not in Chrome. Instead, you can use autocomplete="new-password" , which works on 64-bit, 64-bit, 64-bit versions of Chrome. I also noticed some inconsistent behavior with this attribute, since it does NOT always work - sometimes a list with password options will be displayed on the component (especially until you update a couple of times, etc.).
2a) Instead of extending the component, you can overwrite it by creating the package com.vaadin.client.ui.(component)field in your project, and then put the modified file (component)FieldConnector.java (in my case, I changed PasswordField ) if you want all your instances of this component not to remember passwords. The final class should look like this:
package com.vaadin.client.ui.passwordfield; import com.vaadin.client.ui.VPasswordField; import com.vaadin.client.ui.textfield.TextFieldConnector; import com.vaadin.shared.ui.Connect; import com.vaadin.ui.PasswordField; @Connect(PasswordField.class) public class PasswordFieldConnector extends TextFieldConnector { @Override public VPasswordField getWidget() { VPasswordField vTextField = (VPasswordField) super.getWidget(); vTextField.getElement().setAttribute("autocomplete","new-password"); return vTextField; } }
Thus, you do not need any other class extending TextField (or PasswordField).
2b) If you want to allow some fields to remember passwords and others that do not, you can expand the component and use your preferred component accordingly. You can save your connector class as in 2a), but don't forget to call it something like CustomPasswordFieldConnector , and it should also @Connect with this CustomPasswordField.class, put this class where it fits in your project, and don't forget to add the correct import for it in the connector if necessary. This class is simply fictitious - you can leave its contents empty if you do not need any additional functions (but remember that in this example you need to extend the (component)Field ; PasswordField ).
source share