Guest User

Untitled

a guest
Mar 5th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. map.resource :users,
  2. :collection => {:reset_password => :get,
  3. :reset_password => :post}
  4.  
  5. # GET /users/reset_password => Renders reset_password screen
  6. # POST /users/reset_password?email=joe@blow.com => goes back to login screen with flash
  7.  
  8. UsersController
  9.  
  10. def reset_password
  11. @user = User.find_by_email(params[:email])
  12. @user.reset_password!
  13. respond_to do |format|
  14. format.html do
  15. flash[:notice] = "Successfully reset password, check ur email"
  16. redirect_to login_path
  17. end
  18. end
  19. rescue
  20. # This should get rendered if there is no email param
  21. end
Add Comment
Please, Sign In to add comment