Skip to content

Instantly share code, notes, and snippets.

@universal
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save universal/9601678 to your computer and use it in GitHub Desktop.

Select an option

Save universal/9601678 to your computer and use it in GitHub Desktop.
class UserPasswordResetsController < ApplicationController
#personal preferences here
def update
user = User.find_by(password_reset_token: params[:id])
if !user.present?
head :not_found
elsif !(user.is_activated && user.is_active)
head :unprocessable_entity
elsif user.update_password params[:password], params[:password_confirmation]
head :ok
else
@presenter = UserPasswordResetsPresenter.new(user)
render status: :unprocessable_entity
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment