How can I stop filling the password field while editing?

I have this problem all the time in my rails applications and I still need the right solution. Whenever a user edits his own record, the password field is populated. I suspect its Firefox, since setting @ user.password = nil in the editing action does not help.

The problem is that the password confirmation is not populated, so the check is not performed due to a missed match.

I tried the following:

<%= f.label :password %> <%= f.password_field :password, :value => "", :autofill => false, :class => 'max' %> 

But it does not. I also tried :autofill => 'off' , which doesn't work either.

Does anyone have any suggestions? Thanks.

+6
ruby-on-rails forms webforms actionview actionviewhelper
source share
5 answers

Set autocomplete = "off" in the form and input tags

 <form name="blah" autocomplete="off"> <input type="password" autocomplete="off"> </form> 
+15
source share

The line f.password_field :password, :value => '' did not work for me (on rails 3.1). Although I started the field with f.password_field :password, :value => nil .

Hi

+2
source share

There are two solutions:

  • tell firefox not to fill out these fields;

  • enter in the password field another name from the "password".

+1
source share

HTML settings have their own hash, so the syntax should look like this:

 <%= f.password_field :password, { :value => '' } %> 

This should replace the value attribute in the HTML response.

0
source share

As a field option, you can pass this as follows

 <%= f.password_field :password, {:autocomplete =>"off"} %> 
0
source share

All Articles