Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google chrome autofilling all password inputs

My Problem

I must have turned on google to autofill for a login on my site, however it is trying to now autofill that login data whenever I want to edit my account info or edit another users account info (as an admin). It fills in my data in weird spots. The issue seems to be that Chrome auto fills any input with a type of password and then whatever the input before it is (see image below). If I put a select box before it then it won't autofill.

Google autofilling registration with login details

I obviously don't want to have to go through and delete the password/phone every time I edit a user. I also don't want my users to have to do that when they are editing their own account. How do I remove it?

What I have tried (with no success)

  • Adding autocomplete="off" to the form as well as both the phone and password inputs.
  • Adding value="" to both inputs
  • Changing the name= of the password input. I tried pw, pass, password, and cheese (incase chrome was picking up the name)
  • Adding autocomplete="off" through the jquery .attr

What I have found

I found that Google may be intentionally ignoring autocomplete: Google ignoring autocomplete

I found another user posting a similar question but the solution is not working for me: Disable Chrome Autofill

I also found another user doing a work around involving creating a hidden password field which would take the google autocomplete, I'd prefer a cleaner solution as in my case I would also need a hidden input above it to avoid both from autofilling: Disable autofill in chrome without disabling autocomplete

like image 264
Tyler Avatar asked Apr 18 '14 14:04

Tyler


People also ask

Why is Chrome no longer auto filling passwords?

An outdated browser cache can prevent the Autofill functionality in Chrome from kicking in, so try clearing it. Go to Chrome Settings > Privacy and Security > Clear Browsing Data.


1 Answers

In HTML5 with autocomplete attribute there is a new property called "new-password" which we can use to over come this issue. Following works for me.

<input id="userPassword" type="password" autocomplete="new-password"> 

current-password : Allow the browser or password manager to enter the current password for the site. This provides more information than "on" does, since it lets the browser or password manager know to use the currently-known password for the site in the field, rather than a new one.

new-password : Allow the browser or password manager to automatically enter the new password for the site. This might be automatically generated based on the other attributes of the control, or might simply tell the browser to present a "suggested new password" widget of some kind.

Refer: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/password

like image 114
PRTJ Avatar answered Sep 19 '22 13:09

PRTJ