Autocomplete off For Password Field

2019-08-03 19:14发布

I have a form for editing user details. When i select the form the password field already shows the password in its form field.. So when i just change the other things and then try to save the password also goes for updation.. How can i leave the password field blank.. This is so far what i have tried.. But no luck

<%= f.password_field :password, autocomplete: "off", class: "form-control", placeholder: "Leave as blank if you don't want to change password", value: "" %>

3条回答
别忘想泡老子
2楼-- · 2019-08-03 19:52

There is no problem with your code.

Try clear your remember password in browser. This is because you remembered user at the time of login. Try clear cache and every other thing.

查看更多
劳资没心,怎么记你
3楼-- · 2019-08-03 19:53

Try following these steps:

Delete all your data

  1. Click the Chrome menu Chrome menu on the browser toolbar.
  2. Select Tools.
  3. Select Clear browsing data.
  4. In the dialog that appears, select "Empty the Cache"
  5. Use the menu at the top to select the amount of data that you want to delete. Select beginning of time to delete everything.
  6. Click Clear browsing data.

Taken and modified from: https://support.google.com/chrome/answer/95582?hl=en

查看更多
我只想做你的唯一
4楼-- · 2019-08-03 20:07

EDIT: Previous hack no longer works on current Chrome. Now, autocomplete="new-password" is usable.

Like this <input autocomplete="new-password" type="password" />

=========== old answer ===========

Put this tag at first line of your form.

<input type="password" style="display:none;" />

I think this isn't so cool, but it prevents the autocomplete of password field.

查看更多
登录 后发表回答