Skip to content

How To: Mass password reset and email notification

Eliot Sykes edited this page Jan 1, 2017 · 11 revisions
# path: lib/tasks/devise.rake

namespace :devise do
  desc "Send password reset instructions to all users (but does not actually reset passwords)"
  task send_password_reset_instructions: :environment do
    User.all.each do |user|
      # This only sends the password reset instructions, the
      # password is not changed. (Recipient has to click link
      # in email and follow instructions to actually change
      # the password).
      user.send_reset_password_instructions
    end
  end
end

Clone this wiki locally