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

Asked

Viewed 1,441 times

1

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

How does he do that? I searched the web, I found some tips but none efficient like this site, at least on Crhome.

Follow the link, user and password

http://demo1.centos-webpanel.com:2082
User: testacc
Senha: admin123

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 of interfering. You can even add the attribute autocomplete="off" in your form: <form action="#" method="post" autocomplete="off">. But this will only prevent autocomplete when the user logs in again.

One solution to this problem would be to change the type="password" password field for a type type="text". 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">

  • It’s a good solution, but then I depend on the third link to get the source right?

  • I was able to solve with stack tips <input name="senhapessoal" type="password" id="senhapessoal" required autocomplete="off" readonly onfocus="this.removeAttribute('readonly');this.select();" onBlur="this.setAttribute('readonly', true');" />

  • 1

    It has the source however. But your solution also solves ;). I can assure you that it will work in any browser.

  • Which is guaranteed, from the source or mine? rs

  • um... can I download the source on my machine and have it as a basis not to depend on third link?

  • 2

    https://jsbin-user-assets.s3.amazonaws.com/rafaelcastrocouto/password.ttf just enter here and save

  • blz, grateful marked as accepted

Show 2 more comments

0

In the case of your example, the 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 the autocomplete='off' in the inputs.

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

Chrome forcing the bar

Alternative 1

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

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

Alternative 2

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

<input style="opacity: 0;position: absolute;">
<input type="password" style="opacity: 0;position: absolute;">
  • The next thing I know, in my tests on another page I filled in the password fields and sent it, now Chrome insists on leaving all the fields on other password-type pages filled with the last password used, I’ve tried everything here to clean it up and I can’t, Chrome does this after the page is loaded, I need to warn Chrome that that specific field should not be filled in, but it is difficult. autocomplete='off' does not work

  • This is Chrome’s black magic, here’s a solution: https://stackoverflow.com/a/22694173/6394559

Browser other questions tagged

You are not signed in. Login or sign up in order to post.