How can I not allow the browser to save the entered password? [duplicate]

1

On this site if you log in the browser does not ask you to save the password and if you enter again the fields will be blank.

How does he do it? I searched the web, found some tips but none efficient like this site, at least in the crhome.

Follow the link, username and password

http://demo1.centos-webpanel.com:2082
User: testacc
Senha: admin123
    
asked by anonymous 13.04.2018 / 17:11

2 answers

1

If there are password fields the browser will always ask if the user wants to save the password. This has no way to interfere. You can even add the autocomplete="off" attribute in your form: <form action="#" method="post" autocomplete="off"> . However this will only prevent autocomplete when the user logs in again.

One solution to this problem would be to change the type="password" of the password field to a type="text" type. The css along with a font can be used to work around the mask problem:

@font-face {
  font-family: 'password';
  font-style: normal;      
  src: url(https://jsbin-user-assets.s3.amazonaws.com/rafaelcastrocouto/password.ttf);
}
#password {
  font-family: 'password';
  width: 100px; height: 16px;  
}
<input type="text" name="password" id="password" class="form-control" value="" autocomplete="off" placeholder="Your password">
    
13.04.2018 / 17:31
0

In the case of your example, authentication is done by ajax and does not execute the form submit, preventing the browser from storing the password.

For other cases, you can use autocomplete='off' in inputs.

<input type='text' name='username' autocomplete='off'>

Chrome forcing the bar

Alternative 1

To convert the Chrome case to force the save of the password, you can do something like this by passing any string instead of off in autocomplete.

<input type="text" name="field" autocomplete="nope">

Alternative 2

Another alternative is to include an invisible password above the actual password, Google Chrome applies this rule only for the first input, so yours will be safe.

<input style="opacity: 0;position: absolute;">
<input type="password" style="opacity: 0;position: absolute;">
    
13.04.2018 / 17:17