0
votes

When I try to update my user profile Devise force to update password even if the auto-prepared form has this label: Password (leave blank if you don't want to change it). Why?

EDIT: I want user confirm password every time he change his settings! The problem is that there are three fields:

Password (leave blank if you don't want to change it) Password confirmation Current password (we need your current password to confirm your changes)

I want that if user leave password (FIRST FIELD) blank devise don't give error back.

2

2 Answers

1
votes

See this guide on how to update user profiles without changing the password:

https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-edit-their-account-without-providing-a-password

You can also create your own Users controller with an edit form, and only update the fields you need.

EDIT

If you enter the current password field and NOT the first two fields, there will be no error. This is the default behavior of devise. If you want the current password field to be the first field for the user, move it up in the view.

0
votes

You should NOT add this line in User Model:

validates :password, length: {minimum: 6}