Devise password reset from Rails console

后端 未结 8 967
梦毁少年i
梦毁少年i 2021-01-30 01:38

While running an app how do you select a user by email address and then set the password manually within rails console for Devise?

Also, where would I go to

8条回答
  •  深忆病人
    2021-01-30 02:02

    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

提交回复
热议问题