class PasswordResetsController < ApplicationController
	skip_before_filter :require_login

  def create
  	@user = User.find_by_email(params[:email])

  	@user.deliver_reset_password_instructions! if @user

  	redirect_to :login, notice: 'Instructions have been sent to your email'
  end

  def edit
  	@token = params[:id]
  	@user = User.load_from_reset_password_token(params[:id])

  	if @user.blank?
  		not_authenticated
  		return
  	end
  end

  def update
  	@token = params[:id]
  	@user = User.load_from_reset_password_token(params[:id])

  	if @user.blank?
  		not_authenticated
  		return
  	end

  	@user.password_confirmation = params[:user][:password_confirmation]

  	if @user.change_password!(params[:user][:password])
      auto_login(@user)
  		redirect_to root_path, notice: 'Reset Password was successfully'
  	else
  		render action: :edit
  	end
  end
end

class PasswordResetsController < ApplicationController
	skip_before_filter :require_login

  def create
  	@user = User.find_by_email(params[:email])

  	@user.deliver_reset_password_instructions! if @user

  	redirect_to :login, notice: 'Instructions have been sent to your email'
  end

  def edit
  	@token = params[:id]
  	@user = User.load_from_reset_password_token(params[:id])

  	if @user.blank?
  		not_authenticated
  		return
  	end
  end

  def update
  	@token = params[:id]
  	@user = User.load_from_reset_password_token(params[:id])

  	if @user.blank?
  		not_authenticated
  		return
  	end

    if params[:user][:password].blank?
      flash.now[:alert] = "Password cannot be blank"
      render :edit
    else
      if @user.update_attributes(user_params)
        auto_login(@user)
        redirect_to root_path, notice: 'Reset Password was successfully'
      else
        render :edit
      end
    end
  end


  private
  def user_params
    params.require(:user).permit(
      :password,
      :password_confirmation,
    )
  end
end

Add Provident User From Entering Blanks
Add Provident User From Entering Blanks

Add validation to provident the User from entering blanks into the Reset
Password form because they should not be doing so. Also this will make
the site hard to use since they having if they do not enter a password
then they would have to do the reset password again.
