Devise password reset from Rails console Devise password reset from Rails console ruby ruby

Devise password reset from Rails console


Modern devise allows simpler syntax, no need to set the confirmation field

user.password = new_password; user.save# oruser.update(password: new_password)


# $ rails console productionu=User.where(:email => 'usermail@gmail.com').firstu.password='userpassword'u.password_confirmation='userpassword'u.save!


If you run the following in the rails console it should do the trick:

User.find_by(email: 'user_email_address').reset_password!('new_password','new_password')

http://www.rubydoc.info/github/plataformatec/devise/Devise/Models/Recoverable