You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
Repository navigation
How To: Mass password reset and email notification
# Assign an new random password for each user and send them a email notification# path: lib/tasks/devise.rakenamespace:devisedodesc'Mass password reset and send email instructions'task:mass_password_reset=>:environmentdomodel=ENV['MODEL'] || 'User'beginmodel_mailer="#{model}Mailer".constantizemodel=model.constantizemodel.find_each(:conditions=>'id > 70720')do |record|
# Assign a random passwordrandom_password=User.send(:generate_token,'encrypted_password').slice(0,8)record.password=random_passwordrecord.save# Send change notification (Ensure you have created #{model}Mailer e.g. UserMailer)model_mailer.password_reset(record,random_password).deliverendrescueException=>eputs"Error: #{e.message}"endendend