Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I want to let the user edit his account information. But I want him to enter his old password aswell for verification.
- My form looks like this
- <% form_for @user, :url => account_path do |f| %>
- <%= f.error_messages %>
- <%= f.label :email %><br />
- <%= f.text_field :email %><br />
- <br />
- <%= f.label :password, form.object.new_record? ? nil : "Change password" %><br />
- <%= f.password_field :password %><br />
- <br />
- <%= f.label :password_confirmation %><br />
- <%= f.password_field :password_confirmation %><br />
- <%= f.submit "Update" %>
- <% end %>
- I want to be able to have the following i the form
- <%= f.label :old_password %><br />
- <%= f.hidden_field :old_password %><br />
- so when he submits i can do
- if !@user.valid_password?(params[:old_password])
- flash[:notice] = "Old Password didn't match!!"
- render :action => :edit
- end
Add Comment
Please, Sign In to add comment