aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-08-28 05:01:57 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-28 05:23:34 -0300
commit1851af84c1c7244dc416be9c93a4700b70e801e3 (patch)
tree70c7304b1bf1fb0ed9c8f3425c23ea432b0a64f8 /actionpack/lib/action_view/helpers/form_helper.rb
parentd630c76f3fef54da4859d540060e90cc294b5516 (diff)
downloadrails-1851af84c1c7244dc416be9c93a4700b70e801e3.tar.gz
rails-1851af84c1c7244dc416be9c93a4700b70e801e3.tar.bz2
rails-1851af84c1c7244dc416be9c93a4700b70e801e3.zip
password_field renders with nil value by default
This makes the use of passwords secure by default if you want to render the value of the password_field you have to do for instance f.password_field(:password, :value => @user.password) # => <input type=password id=user_password name=user[password] value=#{@user.password} />
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index d749e31e12..ed83658140 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -624,19 +624,19 @@ module ActionView
#
# ==== Examples
# password_field(:login, :pass, :size => 20)
- # # => <input type="password" id="login_pass" name="login[pass]" size="20" value="#{@login.pass}" />
+ # # => <input type="password" id="login_pass" name="login[pass]" size="20" />
#
- # password_field(:account, :secret, :class => "form_input")
+ # password_field(:account, :secret, :class => "form_input", :value => @account.secret)
# # => <input type="password" id="account_secret" name="account[secret]" value="#{@account.secret}" class="form_input" />
#
# password_field(:user, :password, :onchange => "if $('user[password]').length > 30 { alert('Your password needs to be shorter!'); }")
- # # => <input type="password" id="user_password" name="user[password]" value="#{@user.password}" onchange = "if $('user[password]').length > 30 { alert('Your password needs to be shorter!'); }"/>
+ # # => <input type="password" id="user_password" name="user[password]" onchange = "if $('user[password]').length > 30 { alert('Your password needs to be shorter!'); }"/>
#
# password_field(:account, :pin, :size => 20, :class => 'form_input')
- # # => <input type="password" id="account_pin" name="account[pin]" size="20" value="#{@account.pin}" class="form_input" />
+ # # => <input type="password" id="account_pin" name="account[pin]" size="20" class="form_input" />
#
def password_field(object_name, method, options = {})
- InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("password", options)
+ InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("password", { :value => nil }.merge!(options))
end
# Returns a hidden input tag tailored for accessing a specified attribute (identified by +method+) on an object