Advertisement
Guest User

Untitled

a guest
Jan 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. def changepass
  2. @user = current_user
  3. if(@user.provider != "email")
  4. flash[:notice] = "Invalid action"
  5. render :changepass
  6. else
  7. if request.post?
  8. if @user.update_with_password(:password => params[:password],:current_password => params[:current_password],:password_confirmation => params[:password_confirmation])
  9. # Sign in the user by passing validation in case their password changed
  10. sign_in @user, :bypass => true
  11. flash[:success] = "Password succesfuly changed"
  12. render :changepass, :success => true
  13. else
  14. render :changepass
  15. end
  16. end
  17. end
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement