Guest User

Untitled

a guest
Mar 13th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. Index: app/controllers/lost_password_controller.rb
  2. ===================================================================
  3. --- app/controllers/lost_password_controller.rb (revision 4821)
  4. +++ app/controllers/lost_password_controller.rb (working copy)
  5. @@ -59,15 +59,18 @@
  6. end
  7.  
  8. if reset_token.respond_to?( :expires ) && reset_token.expires >= Time.now.utc
  9. - if reset_token.user.nil? # if user associated with this reset_token doesn't exist
  10. + user = reset_token.user
  11. +
  12. + if user.nil? # if user associated with this reset_token doesn't exist
  13. # Render show page
  14. render :action => :show and return
  15. end
  16.  
  17. - reset_token.user.password = params[:password]
  18. - reset_token.user.password_confirmation = params[:password_confirmation]
  19. + user.password = params[:password]
  20. + user.password_confirmation = params[:password_confirmation]
  21.  
  22. - if reset_token.user.save
  23. + if user.save
  24. + puts "Changed the password to #{user.password}"
  25. # Redirect to homepage or destination url
  26. redirect_to reset_token.destination_url.to_s.empty? ? '/' : reset_token.destination_url.to_s
  27. else
Add Comment
Please, Sign In to add comment