ruby on rails - Generating reset_password_token in non-Devise controller -


i processing form new controller , using email, want automatically send user reset password email. there kind of devise short-code have call in order this?

assuming have recoverable set up, user model should have send_reset_password_instructions method available. use it, in controller:

 user = user.find_by_email(params[:email])  user.send_reset_password_instructions  flash[:notice] = "reset password instructions have been sent #{user.email}."  redirect_to whatever_path 

for more on method, see documentation: http://rubydoc.info/github/plataformatec/devise/master/devise/models/recoverable#send_reset_password_instructions-instance_method.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -